mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Update database to version 10 (add fields to processors, add instruction set and extensions)
This commit is contained in:
@@ -49,95 +49,111 @@ namespace Cicm.Database
|
|||||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `admins`");
|
Console.WriteLine("Creating table `admins`");
|
||||||
dbCmd.CommandText = V8.Admins;
|
dbCmd.CommandText = V10.Admins;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `browser_tests`");
|
Console.WriteLine("Creating table `browser_tests`");
|
||||||
dbCmd.CommandText = V8.BrowserTests;
|
dbCmd.CommandText = V10.BrowserTests;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `cicm_db`");
|
Console.WriteLine("Creating table `cicm_db`");
|
||||||
dbCmd.CommandText = V8.CicmDb;
|
dbCmd.CommandText = V10.CicmDb;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `companies`");
|
Console.WriteLine("Creating table `companies`");
|
||||||
dbCmd.CommandText = V8.Companies;
|
dbCmd.CommandText = V10.Companies;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `computers`");
|
Console.WriteLine("Creating table `computers`");
|
||||||
dbCmd.CommandText = V8.Computers;
|
dbCmd.CommandText = V10.Computers;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `consoles`");
|
Console.WriteLine("Creating table `consoles`");
|
||||||
dbCmd.CommandText = V8.Consoles;
|
dbCmd.CommandText = V10.Consoles;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `disk_formats`");
|
Console.WriteLine("Creating table `disk_formats`");
|
||||||
dbCmd.CommandText = V8.DiskFormats;
|
dbCmd.CommandText = V10.DiskFormats;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `forbidden`");
|
Console.WriteLine("Creating table `forbidden`");
|
||||||
dbCmd.CommandText = V8.Forbidden;
|
dbCmd.CommandText = V10.Forbidden;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `gpus`");
|
Console.WriteLine("Creating table `gpus`");
|
||||||
dbCmd.CommandText = V8.Gpus;
|
dbCmd.CommandText = V10.Gpus;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `log`");
|
Console.WriteLine("Creating table `log`");
|
||||||
dbCmd.CommandText = V8.Logs;
|
dbCmd.CommandText = V10.Logs;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `money_donations`");
|
Console.WriteLine("Creating table `money_donations`");
|
||||||
dbCmd.CommandText = V8.MoneyDonations;
|
dbCmd.CommandText = V10.MoneyDonations;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `music_synths`");
|
Console.WriteLine("Creating table `music_synths`");
|
||||||
dbCmd.CommandText = V8.MusicSynths;
|
dbCmd.CommandText = V10.MusicSynths;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `news`");
|
Console.WriteLine("Creating table `news`");
|
||||||
dbCmd.CommandText = V8.News;
|
dbCmd.CommandText = V10.News;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `owned_computers`");
|
Console.WriteLine("Creating table `owned_computers`");
|
||||||
dbCmd.CommandText = V8.OwnedComputers;
|
dbCmd.CommandText = V10.OwnedComputers;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `owned_consoles`");
|
Console.WriteLine("Creating table `owned_consoles`");
|
||||||
dbCmd.CommandText = V8.OwnedConsoles;
|
dbCmd.CommandText = V10.OwnedConsoles;
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
Console.WriteLine("Creating table `instruction_sets`");
|
||||||
|
dbCmd.CommandText = V10.InstructionSets;
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
Console.WriteLine("Creating table `instruction_set_extensions`");
|
||||||
|
dbCmd.CommandText = V10.InstructionSetExtensions;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `processors`");
|
Console.WriteLine("Creating table `processors`");
|
||||||
dbCmd.CommandText = V8.Processors;
|
dbCmd.CommandText = V10.Processors;
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
Console.WriteLine("Creating table `instruction_set_extensions_by_processor`");
|
||||||
|
dbCmd.CommandText = V10.InstructionSetExtensionsByProcessor;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `sound_synths`");
|
Console.WriteLine("Creating table `sound_synths`");
|
||||||
dbCmd.CommandText = V8.SoundSynths;
|
dbCmd.CommandText = V10.SoundSynths;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `iso3166_1_numeric`");
|
Console.WriteLine("Creating table `iso3166_1_numeric`");
|
||||||
dbCmd.CommandText = V8.Iso3166Numeric;
|
dbCmd.CommandText = V10.Iso3166Numeric;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Filling table `iso3166_1_numeric`");
|
Console.WriteLine("Filling table `iso3166_1_numeric`");
|
||||||
dbCmd.CommandText = V8.Iso3166NumericValues;
|
dbCmd.CommandText = V10.Iso3166NumericValues;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating foreign keys for table `companies`");
|
Console.WriteLine("Creating foreign keys for table `companies`");
|
||||||
dbCmd.CommandText = V8.CompaniesForeignKeys;
|
dbCmd.CommandText = V10.CompaniesForeignKeys;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating foreign keys for table `computers`");
|
Console.WriteLine("Creating foreign keys for table `computers`");
|
||||||
dbCmd.CommandText = V8.ComputersForeignKeys;
|
dbCmd.CommandText = V10.ComputersForeignKeys;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating foreign keys for table `consoles`");
|
Console.WriteLine("Creating foreign keys for table `consoles`");
|
||||||
dbCmd.CommandText = V8.ConsolesForeignKeys;
|
dbCmd.CommandText = V10.ConsolesForeignKeys;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
Console.WriteLine("Creating table `company_logos`");
|
Console.WriteLine("Creating table `company_logos`");
|
||||||
dbCmd.CommandText = V8.CompanyLogos;
|
dbCmd.CommandText = V10.CompanyLogos;
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
|
Console.WriteLine("Creating table `company_descriptions`");
|
||||||
|
dbCmd.CommandText = V10.CompanyDescriptions;
|
||||||
dbCmd.ExecuteNonQuery();
|
dbCmd.ExecuteNonQuery();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
285
Cicm.Database/Operations/InstructionSet.cs
Normal file
285
Cicm.Database/Operations/InstructionSet.cs
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : InstructionSet.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Contains operations to manage instruction_sets.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using Cicm.Database.Schemas;
|
||||||
|
using Console = System.Console;
|
||||||
|
|
||||||
|
namespace Cicm.Database
|
||||||
|
{
|
||||||
|
public partial class Operations
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all instruction sets
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entries">All instruction sets</param>
|
||||||
|
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||||
|
public bool GetInstructionSets(out List<InstructionSet> entries)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Getting all instruction sets...");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const string SQL = "SELECT * from instruction_sets";
|
||||||
|
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbCmd.CommandText = SQL;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbCmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
|
||||||
|
entries = InstructionSetsFromDataTable(dataSet.Tables[0]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error getting instruction sets.");
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
entries = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the specified number of instruction sets since the specified start
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entries">List of instruction sets</param>
|
||||||
|
/// <param name="start">Start of query</param>
|
||||||
|
/// <param name="count">How many entries to retrieve</param>
|
||||||
|
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||||
|
public bool GetInstructionSets(out List<InstructionSet> entries, ulong start, ulong count)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Getting {0} instruction sets from {1}...", count, start);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sql = $"SELECT * FROM instruction_sets LIMIT {start}, {count}";
|
||||||
|
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbCmd.CommandText = sql;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbCmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
|
||||||
|
entries = InstructionSetsFromDataTable(dataSet.Tables[0]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error getting instruction sets.");
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
entries = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets instruction set by specified id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Id</param>
|
||||||
|
/// <returns>InstructionSet with specified id, <c>null</c> if not found or error</returns>
|
||||||
|
public InstructionSet GetInstructionSet(int id)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Getting instruction set with id {0}...", id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sql = $"SELECT * from instruction_sets WHERE id = '{id}'";
|
||||||
|
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbCmd.CommandText = sql;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbCmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
|
||||||
|
List<InstructionSet> entries = InstructionSetsFromDataTable(dataSet.Tables[0]);
|
||||||
|
|
||||||
|
return entries == null || entries.Count == 0 ? null : entries[0];
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error getting instruction set.");
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Counts the number of instruction sets in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Entries in database</returns>
|
||||||
|
public long CountInstructionSets()
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Counting instruction_sets...");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
dbcmd.CommandText = "SELECT COUNT(*) FROM instruction_sets";
|
||||||
|
object count = dbcmd.ExecuteScalar();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
try { return Convert.ToInt64(count); }
|
||||||
|
catch { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new instruction set to the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entry">Entry to add</param>
|
||||||
|
/// <param name="id">ID of added entry</param>
|
||||||
|
/// <returns><c>true</c> if added correctly, <c>false</c> otherwise</returns>
|
||||||
|
public bool AddInstructionSet(InstructionSet entry, out long id)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.Write("Adding instruction set `{0}`...", entry.Name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = GetCommandInstructionSet(entry);
|
||||||
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
|
dbcmd.Transaction = trans;
|
||||||
|
|
||||||
|
const string SQL = "INSERT INTO instruction_sets (instruction_set) VALUES (@instruction_set)";
|
||||||
|
|
||||||
|
dbcmd.CommandText = SQL;
|
||||||
|
|
||||||
|
dbcmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
|
||||||
|
id = dbCore.LastInsertRowId;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine(" id {0}", id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updated a instruction set in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entry">Updated entry</param>
|
||||||
|
/// <returns><c>true</c> if updated correctly, <c>false</c> otherwise</returns>
|
||||||
|
public bool UpdateInstructionSet(InstructionSet entry)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Updating instruction set `{0}`...", entry.Name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = GetCommandInstructionSet(entry);
|
||||||
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
|
dbcmd.Transaction = trans;
|
||||||
|
|
||||||
|
string sql = "UPDATE instruction_sets SET instruction_set = @instruction_set " + $"WHERE id = {entry.Id}";
|
||||||
|
|
||||||
|
dbcmd.CommandText = sql;
|
||||||
|
|
||||||
|
dbcmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a instruction set from the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of entry to remove</param>
|
||||||
|
/// <returns><c>true</c> if removed correctly, <c>false</c> otherwise</returns>
|
||||||
|
public bool RemoveInstructionSet(long id)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Removing instruction set widh id `{0}`...", id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
|
dbcmd.Transaction = trans;
|
||||||
|
|
||||||
|
string sql = $"DELETE FROM instruction_sets WHERE id = '{id}';";
|
||||||
|
|
||||||
|
dbcmd.CommandText = sql;
|
||||||
|
|
||||||
|
dbcmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDbCommand GetCommandInstructionSet(InstructionSet entry)
|
||||||
|
{
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
|
||||||
|
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||||
|
|
||||||
|
param1.ParameterName = "@instruction_set";
|
||||||
|
|
||||||
|
param1.DbType = DbType.String;
|
||||||
|
|
||||||
|
param1.Value = entry.Name;
|
||||||
|
|
||||||
|
dbcmd.Parameters.Add(param1);
|
||||||
|
|
||||||
|
return dbcmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<InstructionSet> InstructionSetsFromDataTable(DataTable dataTable)
|
||||||
|
{
|
||||||
|
List<InstructionSet> entries = new List<InstructionSet>();
|
||||||
|
|
||||||
|
foreach(DataRow dataRow in dataTable.Rows)
|
||||||
|
{
|
||||||
|
InstructionSet entry = new InstructionSet
|
||||||
|
{
|
||||||
|
Id = int.Parse(dataRow["id"].ToString()),
|
||||||
|
Name = dataRow["instruction_set"].ToString()
|
||||||
|
};
|
||||||
|
|
||||||
|
entries.Add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
324
Cicm.Database/Operations/InstructionSetExtension.cs
Normal file
324
Cicm.Database/Operations/InstructionSetExtension.cs
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : InstructionSet.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Contains operations to manage instruction_set_extensions.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using Cicm.Database.Schemas;
|
||||||
|
using Console = System.Console;
|
||||||
|
|
||||||
|
namespace Cicm.Database
|
||||||
|
{
|
||||||
|
public partial class Operations
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all instruction set extensions
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entries">All instruction set extensions</param>
|
||||||
|
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||||
|
public bool GetInstructionSetExtensions(out List<InstructionSetExtension> entries)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Getting all instruction set extensions...");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const string SQL = "SELECT * from instruction_set_extensions";
|
||||||
|
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbCmd.CommandText = SQL;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbCmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
|
||||||
|
entries = InstructionSetExtensionsFromDataTable(dataSet.Tables[0]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error getting instruction set extensions.");
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
entries = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the specified number of instruction set extensions since the specified start
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entries">List of instruction set extensions</param>
|
||||||
|
/// <param name="start">Start of query</param>
|
||||||
|
/// <param name="count">How many entries to retrieve</param>
|
||||||
|
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||||
|
public bool GetInstructionSetExtensions(out List<InstructionSetExtension> entries, ulong start, ulong count)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Getting {0} instruction set extensions from {1}...", count, start);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sql = $"SELECT * FROM instruction_set_extensions LIMIT {start}, {count}";
|
||||||
|
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbCmd.CommandText = sql;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbCmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
|
||||||
|
entries = InstructionSetExtensionsFromDataTable(dataSet.Tables[0]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error getting instruction set extensions.");
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
entries = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets instruction set extension by specified id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Id</param>
|
||||||
|
/// <returns>InstructionSet with specified id, <c>null</c> if not found or error</returns>
|
||||||
|
public InstructionSetExtension GetInstructionSetExtension(int id)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Getting instruction set extension with id {0}...", id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sql = $"SELECT * from instruction_set_extensions WHERE id = '{id}'";
|
||||||
|
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbCmd.CommandText = sql;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbCmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
|
||||||
|
List<InstructionSetExtension> entries = InstructionSetExtensionsFromDataTable(dataSet.Tables[0]);
|
||||||
|
|
||||||
|
return entries == null || entries.Count == 0 ? null : entries[0];
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error getting instruction set extension.");
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<InstructionSetExtension> GetInstructionSetExtensions(int processor)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Getting instruction set extension for processor id {0}...", processor);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sql =
|
||||||
|
$"SELECT * from instruction_set_extensions_by_processor WHERE processor_id = '{processor}'";
|
||||||
|
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbCmd.CommandText = sql;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbCmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
|
||||||
|
if(dataSet.Tables[0].Rows.Count == 0) return null;
|
||||||
|
|
||||||
|
List<InstructionSetExtension> entries = new List<InstructionSetExtension>();
|
||||||
|
foreach(DataRow dataRow in dataSet.Tables[0].Rows)
|
||||||
|
{
|
||||||
|
if(!int.TryParse(dataRow["extension_id"].ToString(), out int extensionId)) continue;
|
||||||
|
if(extensionId == 0) continue;
|
||||||
|
|
||||||
|
entries.Add(GetInstructionSetExtension(extensionId));
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error getting instruction set extension.");
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Counts the number of instruction set extensions in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Entries in database</returns>
|
||||||
|
public long CountInstructionSetExtensions()
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Counting instruction_set_extensions...");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
dbcmd.CommandText = "SELECT COUNT(*) FROM instruction_set_extensions";
|
||||||
|
object count = dbcmd.ExecuteScalar();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
try { return Convert.ToInt64(count); }
|
||||||
|
catch { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new instruction set extension to the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entry">Entry to add</param>
|
||||||
|
/// <param name="id">ID of added entry</param>
|
||||||
|
/// <returns><c>true</c> if added correctly, <c>false</c> otherwise</returns>
|
||||||
|
public bool AddInstructionSetExtension(InstructionSetExtension entry, out long id)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.Write("Adding instruction set extension `{0}`...", entry.Name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = GetCommandInstructionSetExtension(entry);
|
||||||
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
|
dbcmd.Transaction = trans;
|
||||||
|
|
||||||
|
const string SQL = "INSERT INTO instruction_set_extensions (extension) VALUES (@extension)";
|
||||||
|
|
||||||
|
dbcmd.CommandText = SQL;
|
||||||
|
|
||||||
|
dbcmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
|
||||||
|
id = dbCore.LastInsertRowId;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine(" id {0}", id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updated a instruction set extension in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entry">Updated entry</param>
|
||||||
|
/// <returns><c>true</c> if updated correctly, <c>false</c> otherwise</returns>
|
||||||
|
public bool UpdateInstructionSetExtension(InstructionSetExtension entry)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Updating instruction set extension `{0}`...", entry.Name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = GetCommandInstructionSetExtension(entry);
|
||||||
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
|
dbcmd.Transaction = trans;
|
||||||
|
|
||||||
|
string sql = "UPDATE instruction_set_extensions SET extension = @extension " + $"WHERE id = {entry.Id}";
|
||||||
|
|
||||||
|
dbcmd.CommandText = sql;
|
||||||
|
|
||||||
|
dbcmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a instruction set extension from the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">ID of entry to remove</param>
|
||||||
|
/// <returns><c>true</c> if removed correctly, <c>false</c> otherwise</returns>
|
||||||
|
public bool RemoveInstructionSetExtension(long id)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Console.WriteLine("Removing instruction set extension widh id `{0}`...", id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
|
dbcmd.Transaction = trans;
|
||||||
|
|
||||||
|
string sql = $"DELETE FROM instruction_set_extensions WHERE id = '{id}';";
|
||||||
|
|
||||||
|
dbcmd.CommandText = sql;
|
||||||
|
|
||||||
|
dbcmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbcmd.Dispose();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
IDbCommand GetCommandInstructionSetExtension(InstructionSetExtension entry)
|
||||||
|
{
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
|
||||||
|
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||||
|
|
||||||
|
param1.ParameterName = "@extension";
|
||||||
|
|
||||||
|
param1.DbType = DbType.String;
|
||||||
|
|
||||||
|
param1.Value = entry.Name;
|
||||||
|
|
||||||
|
dbcmd.Parameters.Add(param1);
|
||||||
|
|
||||||
|
return dbcmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<InstructionSetExtension> InstructionSetExtensionsFromDataTable(DataTable dataTable)
|
||||||
|
{
|
||||||
|
List<InstructionSetExtension> entries = new List<InstructionSetExtension>();
|
||||||
|
|
||||||
|
foreach(DataRow dataRow in dataTable.Rows)
|
||||||
|
{
|
||||||
|
InstructionSetExtension entry = new InstructionSetExtension
|
||||||
|
{
|
||||||
|
Id = int.Parse(dataRow["id"].ToString()),
|
||||||
|
Name = dataRow["extension"].ToString()
|
||||||
|
};
|
||||||
|
|
||||||
|
entries.Add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ namespace Cicm.Database
|
|||||||
public partial class Operations
|
public partial class Operations
|
||||||
{
|
{
|
||||||
/// <summary>Last known database version</summary>
|
/// <summary>Last known database version</summary>
|
||||||
const int DB_VERSION = 9;
|
const int DB_VERSION = 10;
|
||||||
|
|
||||||
readonly IDbConnection dbCon;
|
readonly IDbConnection dbCon;
|
||||||
readonly IDbCore dbCore;
|
readonly IDbCore dbCore;
|
||||||
|
|||||||
@@ -210,7 +210,15 @@ namespace Cicm.Database
|
|||||||
IDbTransaction trans = dbCon.BeginTransaction();
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
dbcmd.Transaction = trans;
|
dbcmd.Transaction = trans;
|
||||||
|
|
||||||
string sql = "UPDATE processors SET name = @name " + $"WHERE id = {entry.Id}";
|
string sql = "UPDATE processors SET name = @name, company = @company, model_code = @model_code," +
|
||||||
|
"introduced = @introduced, instruction_set = @instruction_set, speed = @speed, " +
|
||||||
|
"package = @package, GPRs = @GPRs, GPR_size = @GPR_size, FPRs = @FPRs, FPR_size = @FPR_size," +
|
||||||
|
"cores = @cores, threads_per_core = @threads_per_core, process = @process," +
|
||||||
|
"process_nm = @process_nm, die_size = @die_size, transistors = @transistors," +
|
||||||
|
"data_bus = @data_bus, addr_bus = @addr_bus, SIMD_registers = @SIMD_registers," +
|
||||||
|
"SIMD_size = @SIMD_size, L1_instruction = @L1_instruction, L1_data = @L1_data, L2 = @L2," +
|
||||||
|
"L3 = @L3 " +
|
||||||
|
$"WHERE id = {entry.Id}";
|
||||||
|
|
||||||
dbcmd.CommandText = sql;
|
dbcmd.CommandText = sql;
|
||||||
|
|
||||||
@@ -251,20 +259,116 @@ namespace Cicm.Database
|
|||||||
{
|
{
|
||||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
|
||||||
IDbDataParameter param1 = dbcmd.CreateParameter();
|
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param2 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param3 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param4 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param5 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param6 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param7 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param8 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param9 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param10 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param11 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param12 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param13 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param14 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param15 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param16 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param17 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param18 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param19 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param20 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param21 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param22 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param23 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param24 = dbcmd.CreateParameter();
|
||||||
|
IDbDataParameter param25 = dbcmd.CreateParameter();
|
||||||
|
|
||||||
param1.ParameterName = "@name";
|
param1.ParameterName = "@name";
|
||||||
|
param2.ParameterName = "@company";
|
||||||
|
param3.ParameterName = "@model_code";
|
||||||
|
param4.ParameterName = "@introduced";
|
||||||
|
param5.ParameterName = "@instruction_set";
|
||||||
|
param6.ParameterName = "@speed";
|
||||||
|
param7.ParameterName = "@package";
|
||||||
|
param8.ParameterName = "@GPRs";
|
||||||
|
param9.ParameterName = "@GPR_size";
|
||||||
|
param10.ParameterName = "@FPRs";
|
||||||
|
param11.ParameterName = "@FPR_size";
|
||||||
|
param12.ParameterName = "@cores";
|
||||||
|
param13.ParameterName = "@threads_per_core";
|
||||||
|
param14.ParameterName = "@process";
|
||||||
|
param15.ParameterName = "@process_nm";
|
||||||
|
param16.ParameterName = "@die_size";
|
||||||
|
param17.ParameterName = "@transistors";
|
||||||
|
param18.ParameterName = "@addr_bus";
|
||||||
|
param19.ParameterName = "@data_bus";
|
||||||
|
param20.ParameterName = "@SIMD_registers";
|
||||||
|
param21.ParameterName = "@SIMD_size";
|
||||||
|
param22.ParameterName = "@L1_instruction";
|
||||||
|
param23.ParameterName = "@L1_data";
|
||||||
|
param24.ParameterName = "@L2";
|
||||||
|
param25.ParameterName = "@L3";
|
||||||
|
|
||||||
param1.DbType = DbType.String;
|
param1.DbType = DbType.String;
|
||||||
|
param2.DbType = DbType.Int32;
|
||||||
|
param3.DbType = DbType.String;
|
||||||
|
param4.DbType = DbType.DateTime;
|
||||||
|
param5.DbType = DbType.Int32;
|
||||||
|
param6.DbType = DbType.Double;
|
||||||
|
param7.DbType = DbType.String;
|
||||||
|
param8.DbType = DbType.Int32;
|
||||||
|
param9.DbType = DbType.Int32;
|
||||||
|
param10.DbType = DbType.Int32;
|
||||||
|
param11.DbType = DbType.Int32;
|
||||||
|
param12.DbType = DbType.Int32;
|
||||||
|
param13.DbType = DbType.Int32;
|
||||||
|
param14.DbType = DbType.String;
|
||||||
|
param15.DbType = DbType.Double;
|
||||||
|
param16.DbType = DbType.Double;
|
||||||
|
param17.DbType = DbType.UInt64;
|
||||||
|
param18.DbType = DbType.Int32;
|
||||||
|
param19.DbType = DbType.Int32;
|
||||||
|
param20.DbType = DbType.Int32;
|
||||||
|
param21.DbType = DbType.Int32;
|
||||||
|
param22.DbType = DbType.Double;
|
||||||
|
param23.DbType = DbType.Double;
|
||||||
|
param24.DbType = DbType.Double;
|
||||||
|
param25.DbType = DbType.Double;
|
||||||
|
|
||||||
param1.Value = entry.Name;
|
param1.Value = entry.Name;
|
||||||
|
param2.Value = entry.Company == null ? null : (object)entry.Company.Id;
|
||||||
|
param3.Value = entry.ModelCode;
|
||||||
|
param4.Value = entry.Introduced == DateTime.MinValue ? null : (object)entry.Introduced;
|
||||||
|
param5.Value = entry.InstructionSet?.Name;
|
||||||
|
param6.Value = entry.Speed;
|
||||||
|
param7.Value = entry.Package;
|
||||||
|
param8.Value = entry.Gpr;
|
||||||
|
param9.Value = entry.GprSize;
|
||||||
|
param10.Value = entry.Fpr;
|
||||||
|
param11.Value = entry.FprSize;
|
||||||
|
param12.Value = entry.Cores;
|
||||||
|
param13.Value = entry.ThreadsPerCore;
|
||||||
|
param14.Value = entry.Process;
|
||||||
|
param15.Value = entry.ProcessNm;
|
||||||
|
param16.Value = entry.DieSize;
|
||||||
|
param17.Value = entry.Transistors;
|
||||||
|
param18.Value = entry.AddressBus;
|
||||||
|
param19.Value = entry.DataBus;
|
||||||
|
param20.Value = entry.Simd;
|
||||||
|
param21.Value = entry.SimdSize;
|
||||||
|
param22.Value = entry.L1Instruction;
|
||||||
|
param23.Value = entry.L1Data;
|
||||||
|
param24.Value = entry.L2;
|
||||||
|
param25.Value = entry.L3;
|
||||||
|
|
||||||
dbcmd.Parameters.Add(param1);
|
dbcmd.Parameters.Add(param1);
|
||||||
|
|
||||||
return dbcmd;
|
return dbcmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Processor> ProcessorsFromDataTable(DataTable dataTable)
|
List<Processor> ProcessorsFromDataTable(DataTable dataTable)
|
||||||
{
|
{
|
||||||
List<Processor> entries = new List<Processor>();
|
List<Processor> entries = new List<Processor>();
|
||||||
|
|
||||||
@@ -272,10 +376,40 @@ namespace Cicm.Database
|
|||||||
{
|
{
|
||||||
Processor entry = new Processor
|
Processor entry = new Processor
|
||||||
{
|
{
|
||||||
Id = int.Parse(dataRow["id"].ToString()),
|
Id = int.Parse(dataRow["id"].ToString()),
|
||||||
Name = dataRow["name"].ToString()
|
Name = dataRow["name"].ToString(),
|
||||||
|
ModelCode = dataRow["model_code"].ToString(),
|
||||||
|
Speed = Convert.ToDouble(dataRow["speed"].ToString()),
|
||||||
|
Package = dataRow["package"].ToString(),
|
||||||
|
Gpr = Convert.ToInt32(dataRow["GPRs"].ToString()),
|
||||||
|
GprSize = Convert.ToInt32(dataRow["GPR_size"].ToString()),
|
||||||
|
Fpr = Convert.ToInt32(dataRow["FPRs"].ToString()),
|
||||||
|
FprSize = Convert.ToInt32(dataRow["FPR_size"].ToString()),
|
||||||
|
Cores = Convert.ToInt32(dataRow["cores"].ToString()),
|
||||||
|
ThreadsPerCore = Convert.ToInt32(dataRow["threads_per_core"].ToString()),
|
||||||
|
Process = dataRow["process"].ToString(),
|
||||||
|
ProcessNm = Convert.ToSingle(dataRow["process_nm"].ToString()),
|
||||||
|
DieSize = Convert.ToSingle(dataRow["die_size"].ToString()),
|
||||||
|
Transistors = Convert.ToUInt64(dataRow["transistors"].ToString()),
|
||||||
|
AddressBus = Convert.ToInt32(dataRow["addr_bus"].ToString()),
|
||||||
|
DataBus = Convert.ToInt32(dataRow["data_bus"].ToString()),
|
||||||
|
Simd = Convert.ToInt32(dataRow["SIMD_registers"].ToString()),
|
||||||
|
SimdSize = Convert.ToInt32(dataRow["SIMD_size"].ToString()),
|
||||||
|
L1Instruction = Convert.ToSingle(dataRow["L1_instruction"].ToString()),
|
||||||
|
L1Data = Convert.ToSingle(dataRow["L1_data"].ToString()),
|
||||||
|
L2 = Convert.ToSingle(dataRow["L2"].ToString()),
|
||||||
|
L3 = Convert.ToSingle(dataRow["L3"].ToString())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(dataRow["company"].ToString()))
|
||||||
|
entry.Company = GetCompany(Convert.ToInt32(dataRow["company"].ToString()));
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(dataRow["introduced"].ToString()))
|
||||||
|
entry.Introduced = Convert.ToDateTime(dataRow["introduced"].ToString());
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(dataRow["instruction_set"].ToString()))
|
||||||
|
entry.InstructionSet = GetInstructionSet(Convert.ToInt32(dataRow["instruction_set"].ToString()));
|
||||||
|
|
||||||
entries.Add(entry);
|
entries.Add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,11 @@ namespace Cicm.Database
|
|||||||
UpdateDatabaseToV9();
|
UpdateDatabaseToV9();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 9:
|
||||||
|
{
|
||||||
|
UpdateDatabaseToV10();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OptimizeDatabase();
|
OptimizeDatabase();
|
||||||
@@ -829,6 +834,120 @@ namespace Cicm.Database
|
|||||||
dbCmd.Dispose();
|
dbCmd.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateDatabaseToV10()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Updating database to version 10");
|
||||||
|
|
||||||
|
Console.WriteLine("Creating table `instruction_sets`");
|
||||||
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
IDbTransaction trans = dbCon.BeginTransaction();
|
||||||
|
dbCmd.Transaction = trans;
|
||||||
|
dbCmd.CommandText = V10.InstructionSets;
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbCmd.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("Creating table `instruction_set_extensions`");
|
||||||
|
dbCmd = dbCon.CreateCommand();
|
||||||
|
trans = dbCon.BeginTransaction();
|
||||||
|
dbCmd.Transaction = trans;
|
||||||
|
dbCmd.CommandText = V10.InstructionSetExtensions;
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbCmd.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("Creating table `instruction_set_extensions_by_processor`");
|
||||||
|
dbCmd = dbCon.CreateCommand();
|
||||||
|
trans = dbCon.BeginTransaction();
|
||||||
|
dbCmd.Transaction = trans;
|
||||||
|
dbCmd.CommandText = V10.InstructionSetExtensionsByProcessor;
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbCmd.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("Adding new columns to table `processors`");
|
||||||
|
dbCmd = dbCon.CreateCommand();
|
||||||
|
trans = dbCon.BeginTransaction();
|
||||||
|
dbCmd.Transaction = trans;
|
||||||
|
dbCmd.CommandText = "ALTER TABLE `processors` ADD COLUMN `company` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `model_code` VARCHAR(45) NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `introduced` DATETIME NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `instruction_set` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `speed` DOUBLE NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `package` VARCHAR(45) NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `GPRs` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `GPR_size` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `FPRs` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `FPR_size` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `cores` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `threads_per_core` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `process` VARCHAR(45) NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `process_nm` FLOAT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `die_size` FLOAT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `transistors` BIGINT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `data_bus` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `addr_bus` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `SIMD_registers` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `SIMD_size` INT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `L1_instruction` FLOAT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `L1_data` FLOAT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `L2` FLOAT NULL;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD COLUMN `L3` FLOAT NULL;";
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbCmd.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("Adding new indexes to table `processors`");
|
||||||
|
dbCmd = dbCon.CreateCommand();
|
||||||
|
trans = dbCon.BeginTransaction();
|
||||||
|
dbCmd.Transaction = trans;
|
||||||
|
dbCmd.CommandText =
|
||||||
|
"CREATE INDEX `idx_processors_company` ON `processors` (`company`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_model_code` ON `processors` (`model_code`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_introduced` ON `processors` (`introduced`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_instruction_set` ON `processors` (`instruction_set`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_speed` ON `processors` (`speed`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_package` ON `processors` (`package`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_GPRs` ON `processors` (`GPRs`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_GPR_size` ON `processors` (`GPR_size`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_FPRs` ON `processors` (`FPRs`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_FPR_size` ON `processors` (`FPR_size`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_cores` ON `processors` (`cores`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_threads_per_core` ON `processors` (`threads_per_core`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_process` ON `processors` (`process`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_process_nm` ON `processors` (`process_nm`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_die_size` ON `processors` (`die_size`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_transistors` ON `processors` (`transistors`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_data_bus` ON `processors` (`data_bus`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_addr_bus` ON `processors` (`addr_bus`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_SIMD_registers` ON `processors` (`SIMD_registers`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_SIMD_size` ON `processors` (`SIMD_size`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_L1_instruction` ON `processors` (`L1_instruction`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_L1_data` ON `processors` (`L1_data`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_L2` ON `processors` (`L2`);\n" +
|
||||||
|
"CREATE INDEX `idx_processors_L3` ON `processors` (`L3`);";
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbCmd.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("Adding new foreign keys to table `processors`");
|
||||||
|
dbCmd = dbCon.CreateCommand();
|
||||||
|
trans = dbCon.BeginTransaction();
|
||||||
|
dbCmd.Transaction = trans;
|
||||||
|
dbCmd.CommandText =
|
||||||
|
"ALTER TABLE `processors` ADD FOREIGN KEY `fk_processors_company` (company) REFERENCES `companies` (`id`) ON UPDATE CASCADE;\n" +
|
||||||
|
"ALTER TABLE `processors` ADD FOREIGN KEY `fk_processors_instruction_set` (instruction_set) REFERENCES `instruction_sets` (`id`) ON UPDATE CASCADE;";
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
trans.Commit();
|
||||||
|
dbCmd.Dispose();
|
||||||
|
|
||||||
|
Console.WriteLine("Setting new database version to 10...");
|
||||||
|
dbCmd = dbCon.CreateCommand();
|
||||||
|
dbCmd.CommandText = "INSERT INTO cicm_db (version) VALUES ('10')";
|
||||||
|
dbCmd.ExecuteNonQuery();
|
||||||
|
dbCmd.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
void OptimizeDatabase()
|
void OptimizeDatabase()
|
||||||
{
|
{
|
||||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||||
|
|||||||
40
Cicm.Database/Schemas/InstructionSet.cs
Normal file
40
Cicm.Database/Schemas/InstructionSet.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : InstructionSet.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// High level representation of an instruction set.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
namespace Cicm.Database.Schemas
|
||||||
|
{
|
||||||
|
public class InstructionSet
|
||||||
|
{
|
||||||
|
/// <summary>Instruction Set ID</summary>
|
||||||
|
public int Id;
|
||||||
|
/// <summary>Name of the instruction set</summary>
|
||||||
|
public string Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
Cicm.Database/Schemas/InstructionSetExtension.cs
Normal file
40
Cicm.Database/Schemas/InstructionSetExtension.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : InstructionSet.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// High level representation of an instruction set.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
namespace Cicm.Database.Schemas
|
||||||
|
{
|
||||||
|
public class InstructionSetExtension
|
||||||
|
{
|
||||||
|
/// <summary>Instruction set extension ID</summary>
|
||||||
|
public int Id;
|
||||||
|
/// <summary>Instruction set extension name</summary>
|
||||||
|
public string Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,14 +28,69 @@
|
|||||||
// Copyright © 2003-2018 Natalia Portillo
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Cicm.Database.Schemas
|
namespace Cicm.Database.Schemas
|
||||||
{
|
{
|
||||||
/// <summary>Processor</summary>
|
/// <summary>Processor</summary>
|
||||||
public class Processor
|
public class Processor
|
||||||
{
|
{
|
||||||
|
/// <summary>Size in bits of address bus with host (not interprocessor)</summary>
|
||||||
|
public int AddressBus;
|
||||||
|
/// <summary>Company</summary>
|
||||||
|
public Company Company;
|
||||||
|
/// <summary>How many processor cores per processor package</summary>
|
||||||
|
public int Cores;
|
||||||
|
/// <summary>Size in bits of data bus with host (not interprocessor)</summary>
|
||||||
|
public int DataBus;
|
||||||
|
/// <summary>Size of die in square milimeters</summary>
|
||||||
|
public float DieSize;
|
||||||
|
/// <summary>Number of available Floating Point Registers</summary>
|
||||||
|
public int Fpr;
|
||||||
|
/// <summary>Size in bits of FPRs</summary>
|
||||||
|
public int FprSize;
|
||||||
|
/// <summary>Number of available General Purpose Registers</summary>
|
||||||
|
public int Gpr;
|
||||||
|
/// <summary>Size in bits of GPRs</summary>
|
||||||
|
public int GprSize;
|
||||||
/// <summary>ID</summary>
|
/// <summary>ID</summary>
|
||||||
public int Id;
|
public int Id;
|
||||||
|
/// <summary>Instruction set</summary>
|
||||||
|
public InstructionSet InstructionSet;
|
||||||
|
/// <summary>Extensions to the instruction set that are implemented in this processor</summary>
|
||||||
|
public InstructionSetExtension[] InstructionSetExtensions;
|
||||||
|
/// <summary>Datetime of introduction</summary>
|
||||||
|
public DateTime Introduced;
|
||||||
|
/// <summary>Size in kibibytes of L1 data cache. If 0, <see cref="L1Instruction" /> is size of L1 unified cache</summary>
|
||||||
|
public float L1Data;
|
||||||
|
/// <summary>Size in kibibytes of L1 instruction cache. If <see cref="L1Data" /> is 0, this is size of L1 unified cache</summary>
|
||||||
|
public float L1Instruction;
|
||||||
|
/// <summary>
|
||||||
|
/// Size in kibibytes of L2 cache. It includes cache that's in same physical package but not in same chip die
|
||||||
|
/// (e.g. Pentium II)
|
||||||
|
/// </summary>
|
||||||
|
public float L2;
|
||||||
|
/// <summary>Size in kibibytes of L3 cache</summary>
|
||||||
|
public float L3;
|
||||||
|
/// <summary>Model/SKU code</summary>
|
||||||
|
public string ModelCode;
|
||||||
/// <summary>Name</summary>
|
/// <summary>Name</summary>
|
||||||
public string Name;
|
public string Name;
|
||||||
|
/// <summary>Package</summary>
|
||||||
|
public string Package;
|
||||||
|
/// <summary>Name of litography process</summary>
|
||||||
|
public string Process;
|
||||||
|
/// <summary>Nanometers of litography process</summary>
|
||||||
|
public float ProcessNm;
|
||||||
|
/// <summary>Number of available SIMD registers</summary>
|
||||||
|
public int Simd;
|
||||||
|
/// <summary>Size in bits of SIMD registers</summary>
|
||||||
|
public int SimdSize;
|
||||||
|
/// <summary>Nominal speed, in MHz</summary>
|
||||||
|
public double Speed;
|
||||||
|
/// <summary>How many simultaneos threads can run on each processor core</summary>
|
||||||
|
public int ThreadsPerCore;
|
||||||
|
/// <summary>How many transistors in package</summary>
|
||||||
|
public ulong Transistors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
168
Cicm.Database/Schemas/Sql/V10.cs
Normal file
168
Cicm.Database/Schemas/Sql/V10.cs
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : V9.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Contains SQL queries to create the database version 7.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2003-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
namespace Cicm.Database.Schemas.Sql
|
||||||
|
{
|
||||||
|
public static class V10
|
||||||
|
{
|
||||||
|
public static readonly string Admins = V9.Admins;
|
||||||
|
|
||||||
|
public static readonly string BrowserTests = V9.BrowserTests;
|
||||||
|
|
||||||
|
public static readonly string CicmDb = "CREATE TABLE `cicm_db` (\n" +
|
||||||
|
"`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
|
||||||
|
"`version` int(11) NOT NULL,\n" +
|
||||||
|
"`updated` datetime DEFAULT CURRENT_TIMESTAMP,\n" +
|
||||||
|
"PRIMARY KEY (`id`)\n" + ");\n" +
|
||||||
|
"INSERT INTO cicm_db (version) VALUES ('10');";
|
||||||
|
|
||||||
|
public static readonly string Companies = V9.Companies;
|
||||||
|
|
||||||
|
public static readonly string Computers = V9.Computers;
|
||||||
|
|
||||||
|
public static readonly string Consoles = V9.Consoles;
|
||||||
|
|
||||||
|
public static readonly string DiskFormats = V9.DiskFormats;
|
||||||
|
|
||||||
|
public static readonly string Forbidden = V9.Forbidden;
|
||||||
|
|
||||||
|
public static readonly string Gpus = V9.Gpus;
|
||||||
|
|
||||||
|
public static readonly string Logs = V9.Logs;
|
||||||
|
|
||||||
|
public static readonly string MoneyDonations = V9.MoneyDonations;
|
||||||
|
|
||||||
|
public static readonly string MusicSynths = V9.MusicSynths;
|
||||||
|
|
||||||
|
public static readonly string News = V9.News;
|
||||||
|
|
||||||
|
public static readonly string OwnedComputers = V9.OwnedComputers;
|
||||||
|
|
||||||
|
public static readonly string OwnedConsoles = V9.OwnedConsoles;
|
||||||
|
|
||||||
|
public static readonly string Processors =
|
||||||
|
"CREATE TABLE `processors` (\n" +
|
||||||
|
"`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
|
||||||
|
"`name` char(50) NOT NULL DEFAULT '',\n" +
|
||||||
|
"`company` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`model_code` varchar(45) DEFAULT NULL,\n" +
|
||||||
|
"`introduced` datetime DEFAULT NULL,\n" +
|
||||||
|
"`instruction_set` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`speed` double DEFAULT NULL,\n" +
|
||||||
|
"`package` varchar(45) DEFAULT NULL,\n" +
|
||||||
|
"`GPRs` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`GPR_size` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`FPRs` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`FPR_size` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`cores` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`threads_per_core` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`process` varchar(45) DEFAULT NULL,\n" +
|
||||||
|
"`process_nm` float DEFAULT NULL,\n" +
|
||||||
|
"`die_size` float DEFAULT NULL,\n" +
|
||||||
|
"`transistors` bigint(20) DEFAULT NULL,\n" +
|
||||||
|
"`data_bus` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`addr_bus` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`SIMD_registers` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`SIMD_size` int(11) DEFAULT NULL,\n" +
|
||||||
|
"`L1_instruction` float DEFAULT NULL,\n" +
|
||||||
|
"`L1_data` float DEFAULT NULL,\n" +
|
||||||
|
"`L2` float DEFAULT NULL,\n" +
|
||||||
|
"`L3` float DEFAULT NULL,\n" +
|
||||||
|
"PRIMARY KEY (`id`),\n" +
|
||||||
|
"KEY `idx_processors_name` (`name`),\n" +
|
||||||
|
"KEY `idx_processors_company` (`company`),\n" +
|
||||||
|
"KEY `idx_processors_model_code` (`model_code`),\n" +
|
||||||
|
"KEY `idx_processors_introduced` (`introduced`),\n" +
|
||||||
|
"KEY `idx_processors_instruction_set` (`instruction_set`),\n" +
|
||||||
|
"KEY `idx_processors_speed` (`speed`),\n" +
|
||||||
|
"KEY `idx_processors_package` (`package`),\n" +
|
||||||
|
"KEY `idx_processors_GPRs` (`GPRs`),\n" +
|
||||||
|
"KEY `idx_processors_GPR_size` (`GPR_size`),\n" +
|
||||||
|
"KEY `idx_processors_FPRs` (`FPRs`),\n" +
|
||||||
|
"KEY `idx_processors_FPR_size` (`FPR_size`),\n" +
|
||||||
|
"KEY `idx_processors_cores` (`cores`),\n" +
|
||||||
|
"KEY `idx_processors_threads_per_core` (`threads_per_core`),\n" +
|
||||||
|
"KEY `idx_processors_process` (`process`),\n" +
|
||||||
|
"KEY `idx_processors_process_nm` (`process_nm`),\n" +
|
||||||
|
"KEY `idx_processors_die_size` (`die_size`),\n" +
|
||||||
|
"KEY `idx_processors_transistors` (`transistors`),\n" +
|
||||||
|
"KEY `idx_processors_data_bus` (`data_bus`),\n" +
|
||||||
|
"KEY `idx_processors_addr_bus` (`addr_bus`),\n" +
|
||||||
|
"KEY `idx_processors_SIMD_registers` (`SIMD_registers`),\n" +
|
||||||
|
"KEY `idx_processors_SIMD_size` (`SIMD_size`),\n" +
|
||||||
|
"KEY `idx_processors_L1_instruction` (`L1_instruction`),\n" +
|
||||||
|
"KEY `idx_processors_L1_data` (`L1_data`),\n" +
|
||||||
|
"KEY `idx_processors_L2` (`L2`),\n" +
|
||||||
|
"KEY `idx_processors_L3` (`L3`),\n" +
|
||||||
|
"CONSTRAINT `fk_processors_company` FOREIGN KEY (`company`) REFERENCES `companies` (`id`) ON UPDATE CASCADE,\n" +
|
||||||
|
"CONSTRAINT `fk_processors_instruction_set` FOREIGN KEY (`instruction_set`) REFERENCES `instruction_sets` (`id`) ON UPDATE CASCADE);";
|
||||||
|
|
||||||
|
public static readonly string SoundSynths = V9.SoundSynths;
|
||||||
|
|
||||||
|
public static readonly string ComputersForeignKeys = V9.ComputersForeignKeys;
|
||||||
|
|
||||||
|
public static readonly string ConsolesForeignKeys = V9.ConsolesForeignKeys;
|
||||||
|
|
||||||
|
public static readonly string Iso3166Numeric = V9.Iso3166Numeric;
|
||||||
|
|
||||||
|
public static readonly string Iso3166NumericValues = V9.Iso3166NumericValues;
|
||||||
|
|
||||||
|
public static readonly string CompaniesForeignKeys = V9.CompaniesForeignKeys;
|
||||||
|
|
||||||
|
public static readonly string CompanyLogos = V9.CompanyLogos;
|
||||||
|
|
||||||
|
public static readonly string CompanyDescriptions = V9.CompanyDescriptions;
|
||||||
|
|
||||||
|
public static readonly string InstructionSets = "CREATE TABLE IF NOT EXISTS `instruction_sets` (\n" +
|
||||||
|
"`id` INT NOT NULL AUTO_INCREMENT,\n" +
|
||||||
|
"`instruction_set` VARCHAR(45) NOT NULL,\n" +
|
||||||
|
"PRIMARY KEY (`id`));";
|
||||||
|
|
||||||
|
public static readonly string InstructionSetExtensions =
|
||||||
|
"CREATE TABLE IF NOT EXISTS `instruction_set_extensions` (\n" + "`id` INT NOT NULL AUTO_INCREMENT,\n" +
|
||||||
|
"`extension` VARCHAR(45) NOT NULL,\n" + "PRIMARY KEY (`id`));";
|
||||||
|
|
||||||
|
public static readonly string InstructionSetExtensionsByProcessor =
|
||||||
|
"CREATE TABLE IF NOT EXISTS `instruction_set_extensions_by_processor` (\n" +
|
||||||
|
"`id` INT NOT NULL AUTO_INCREMENT,\n" +
|
||||||
|
"`processor_id` INT NOT NULL,\n" +
|
||||||
|
"`extension_id` INT NOT NULL,\n" +
|
||||||
|
"PRIMARY KEY (`id`, `processor_id`, `extension_id`),\n" +
|
||||||
|
"INDEX `idx_setextension_processor` (`processor_id` ASC),\n" +
|
||||||
|
"INDEX `idx_setextension_extension` (`extension_id` ASC),\n" +
|
||||||
|
"CONSTRAINT `fk_extension_processor_id`\n" +
|
||||||
|
"FOREIGN KEY (`processor_id`)\n" +
|
||||||
|
"REFERENCES `processors` (`id`)\n" + "ON DELETE RESTRICT\n" +
|
||||||
|
"ON UPDATE CASCADE,\n" +
|
||||||
|
"CONSTRAINT `fk_extension_extension_id`\n" + "FOREIGN KEY (`extension_id`)\n" +
|
||||||
|
"REFERENCES `instruction_set_extensions` (`id`)\n" +
|
||||||
|
"ON DELETE RESTRICT\n" + "ON UPDATE CASCADE);";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<Version>3.0.99.156</Version>
|
<Version>3.0.99.158</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user