mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Update DB to version 17: Machines can have an arbitrary number of sound synthetizers,
so use an interconnection table, `sound_by_machine`.
This commit is contained in:
@@ -49,107 +49,111 @@ namespace Cicm.Database
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
|
||||
Console.WriteLine("Creating table `admins`");
|
||||
dbCmd.CommandText = V16.Admins;
|
||||
dbCmd.CommandText = V17.Admins;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `browser_tests`");
|
||||
dbCmd.CommandText = V16.BrowserTests;
|
||||
dbCmd.CommandText = V17.BrowserTests;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `cicm_db`");
|
||||
dbCmd.CommandText = V16.CicmDb;
|
||||
dbCmd.CommandText = V17.CicmDb;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `companies`");
|
||||
dbCmd.CommandText = V16.Companies;
|
||||
dbCmd.CommandText = V17.Companies;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `machines`");
|
||||
dbCmd.CommandText = V16.Machines;
|
||||
dbCmd.CommandText = V17.Machines;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `disk_formats`");
|
||||
dbCmd.CommandText = V16.DiskFormats;
|
||||
dbCmd.CommandText = V17.DiskFormats;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `forbidden`");
|
||||
dbCmd.CommandText = V16.Forbidden;
|
||||
dbCmd.CommandText = V17.Forbidden;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `gpus`");
|
||||
dbCmd.CommandText = V16.Gpus;
|
||||
dbCmd.CommandText = V17.Gpus;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `log`");
|
||||
dbCmd.CommandText = V16.Logs;
|
||||
dbCmd.CommandText = V17.Logs;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `money_donations`");
|
||||
dbCmd.CommandText = V16.MoneyDonations;
|
||||
dbCmd.CommandText = V17.MoneyDonations;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `news`");
|
||||
dbCmd.CommandText = V16.News;
|
||||
dbCmd.CommandText = V17.News;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `owned_computers`");
|
||||
dbCmd.CommandText = V16.OwnedComputers;
|
||||
dbCmd.CommandText = V17.OwnedComputers;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `owned_consoles`");
|
||||
dbCmd.CommandText = V16.OwnedConsoles;
|
||||
dbCmd.CommandText = V17.OwnedConsoles;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_sets`");
|
||||
dbCmd.CommandText = V16.InstructionSets;
|
||||
dbCmd.CommandText = V17.InstructionSets;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_set_extensions`");
|
||||
dbCmd.CommandText = V16.InstructionSetExtensions;
|
||||
dbCmd.CommandText = V17.InstructionSetExtensions;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `processors`");
|
||||
dbCmd.CommandText = V16.Processors;
|
||||
dbCmd.CommandText = V17.Processors;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_set_extensions_by_processor`");
|
||||
dbCmd.CommandText = V16.InstructionSetExtensionsByProcessor;
|
||||
dbCmd.CommandText = V17.InstructionSetExtensionsByProcessor;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `sound_synths`");
|
||||
dbCmd.CommandText = V16.SoundSynths;
|
||||
dbCmd.CommandText = V17.SoundSynths;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `iso3166_1_numeric`");
|
||||
dbCmd.CommandText = V16.Iso3166Numeric;
|
||||
dbCmd.CommandText = V17.Iso3166Numeric;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Filling table `iso3166_1_numeric`");
|
||||
dbCmd.CommandText = V16.Iso3166NumericValues;
|
||||
dbCmd.CommandText = V17.Iso3166NumericValues;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating foreign keys for table `companies`");
|
||||
dbCmd.CommandText = V16.CompaniesForeignKeys;
|
||||
dbCmd.CommandText = V17.CompaniesForeignKeys;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating foreign keys for table `machines`");
|
||||
dbCmd.CommandText = V16.MachinesForeignKeys;
|
||||
dbCmd.CommandText = V17.MachinesForeignKeys;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `company_logos`");
|
||||
dbCmd.CommandText = V16.CompanyLogos;
|
||||
dbCmd.CommandText = V17.CompanyLogos;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `company_descriptions`");
|
||||
dbCmd.CommandText = V16.CompanyDescriptions;
|
||||
dbCmd.CommandText = V17.CompanyDescriptions;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `processors_by_machine`");
|
||||
dbCmd.CommandText = V16.ProcessorsByMachine;
|
||||
dbCmd.CommandText = V17.ProcessorsByMachine;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `gpus_by_machine`");
|
||||
dbCmd.CommandText = V16.GpusByMachine;
|
||||
dbCmd.CommandText = V17.GpusByMachine;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `sound_by_machine`");
|
||||
dbCmd.CommandText = V17.SoundByMachine;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -214,10 +214,9 @@ namespace Cicm.Database
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
const string SQL =
|
||||
"INSERT INTO machines (company, year, model, ram, rom, vram, colors, res, sound_synth, music_synth, " +
|
||||
"sound_channels, music_channels, hdd1, hdd2, hdd3, disk1, cap1, disk2, cap2, type)" +
|
||||
" VALUES (@company, @year, @model, @ram, @rom, @vram, @colors, @res, @sound_synth, @music_synth, " +
|
||||
"@sound_channels, @music_channels, @hdd1, @hdd2, @hdd3, @disk1, @cap1, @disk2, @cap2, @type)";
|
||||
"INSERT INTO machines (company, year, model, ram, rom, vram, colors, res, hdd1, hdd2, hdd3, disk1, " +
|
||||
"cap1, disk2, cap2, type) VALUES (@company, @year, @model, @ram, @rom, @vram, @colors, @res, @hdd1, " +
|
||||
"@hdd2, @hdd3, @disk1, @cap1, @disk2, @cap2, @type)";
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
@@ -251,10 +250,8 @@ namespace Cicm.Database
|
||||
|
||||
string sql =
|
||||
"UPDATE machines SET company = @company, year = @year, model = @model, ram = @ram, rom = @rom, " +
|
||||
"vram = @vram, colors = @colors, res = @res, sound_synth = @sound_synth, " +
|
||||
"music_synth = @music_synth, sound_channels = @sound_channels, music_channels = @music_channels, " +
|
||||
"hdd1 = @hdd1, hdd2 = @hdd2, hdd3 = @hdd3, disk1 = @disk1, cap1 = @cap1, disk2 = @disk2, cap2 = @cap2, " +
|
||||
"type = @type " +
|
||||
"vram = @vram, colors = @colors, res = @res, hdd1 = @hdd1, hdd2 = @hdd2, hdd3 = @hdd3, disk1 = @disk1, " +
|
||||
"cap1 = @cap1, disk2 = @disk2, cap2 = @cap2, type = @type " +
|
||||
$"WHERE id = {entry.Id}";
|
||||
|
||||
dbcmd.CommandText = sql;
|
||||
@@ -304,7 +301,7 @@ namespace Cicm.Database
|
||||
IDbDataParameter param6 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param7 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param8 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param9 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param9 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param10 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param11 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param12 = dbcmd.CreateParameter();
|
||||
@@ -312,10 +309,6 @@ namespace Cicm.Database
|
||||
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();
|
||||
|
||||
param1.ParameterName = "@company";
|
||||
param2.ParameterName = "@year";
|
||||
@@ -325,18 +318,14 @@ namespace Cicm.Database
|
||||
param6.ParameterName = "@vram";
|
||||
param7.ParameterName = "@colors";
|
||||
param8.ParameterName = "@res";
|
||||
param9.ParameterName = "@sound_synth";
|
||||
param10.ParameterName = "@music_synth";
|
||||
param11.ParameterName = "@sound_channels";
|
||||
param12.ParameterName = "@music_channels";
|
||||
param13.ParameterName = "@hdd1";
|
||||
param14.ParameterName = "@hdd2";
|
||||
param15.ParameterName = "@hdd3";
|
||||
param16.ParameterName = "@disk1";
|
||||
param17.ParameterName = "@cap1";
|
||||
param18.ParameterName = "@disk2";
|
||||
param19.ParameterName = "@cap2";
|
||||
param20.ParameterName = "@type";
|
||||
param9.ParameterName = "@hdd1";
|
||||
param10.ParameterName = "@hdd2";
|
||||
param11.ParameterName = "@hdd3";
|
||||
param12.ParameterName = "@disk1";
|
||||
param13.ParameterName = "@cap1";
|
||||
param14.ParameterName = "@disk2";
|
||||
param15.ParameterName = "@cap2";
|
||||
param16.ParameterName = "@type";
|
||||
|
||||
param1.DbType = DbType.Int32;
|
||||
param2.DbType = DbType.Int32;
|
||||
@@ -346,18 +335,14 @@ namespace Cicm.Database
|
||||
param6.DbType = DbType.Int32;
|
||||
param7.DbType = DbType.Int32;
|
||||
param8.DbType = DbType.String;
|
||||
param9.DbType = DbType.Int32;
|
||||
param9.DbType = DbType.Int32;
|
||||
param10.DbType = DbType.Int32;
|
||||
param11.DbType = DbType.Int32;
|
||||
param12.DbType = DbType.Int32;
|
||||
param13.DbType = DbType.Int32;
|
||||
param13.DbType = DbType.String;
|
||||
param14.DbType = DbType.Int32;
|
||||
param15.DbType = DbType.Int32;
|
||||
param15.DbType = DbType.String;
|
||||
param16.DbType = DbType.Int32;
|
||||
param17.DbType = DbType.String;
|
||||
param18.DbType = DbType.Int32;
|
||||
param19.DbType = DbType.String;
|
||||
param20.DbType = DbType.Int32;
|
||||
|
||||
param1.Value = entry.Company;
|
||||
param2.Value = entry.Year;
|
||||
@@ -367,18 +352,14 @@ namespace Cicm.Database
|
||||
param6.Value = entry.Vram;
|
||||
param7.Value = entry.Colors;
|
||||
param8.Value = entry.Resolution;
|
||||
param9.Value = entry.SoundSynth;
|
||||
param10.Value = entry.MusicSynth;
|
||||
param11.Value = entry.SoundChannels;
|
||||
param12.Value = entry.MusicChannels;
|
||||
param13.Value = entry.Hdd1;
|
||||
param14.Value = entry.Hdd2;
|
||||
param15.Value = entry.Hdd3;
|
||||
param16.Value = entry.Disk1;
|
||||
param17.Value = entry.Cap1;
|
||||
param18.Value = entry.Disk2;
|
||||
param19.Value = entry.Cap2;
|
||||
param20.Value = entry.Type;
|
||||
param9.Value = entry.Hdd1;
|
||||
param10.Value = entry.Hdd2;
|
||||
param11.Value = entry.Hdd3;
|
||||
param12.Value = entry.Disk1;
|
||||
param13.Value = entry.Cap1;
|
||||
param14.Value = entry.Disk2;
|
||||
param15.Value = entry.Cap2;
|
||||
param16.Value = entry.Type;
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
dbcmd.Parameters.Add(param2);
|
||||
@@ -396,10 +377,6 @@ namespace Cicm.Database
|
||||
dbcmd.Parameters.Add(param14);
|
||||
dbcmd.Parameters.Add(param15);
|
||||
dbcmd.Parameters.Add(param16);
|
||||
dbcmd.Parameters.Add(param17);
|
||||
dbcmd.Parameters.Add(param18);
|
||||
dbcmd.Parameters.Add(param19);
|
||||
dbcmd.Parameters.Add(param20);
|
||||
|
||||
return dbcmd;
|
||||
}
|
||||
@@ -412,27 +389,23 @@ namespace Cicm.Database
|
||||
{
|
||||
Machine entry = new Machine
|
||||
{
|
||||
Id = (int)dataRow["id"],
|
||||
Company = (int)dataRow["company"],
|
||||
Year = (int)dataRow["year"],
|
||||
Model = (string)dataRow["model"],
|
||||
Ram = (int)dataRow["ram"],
|
||||
Rom = (int)dataRow["rom"],
|
||||
Vram = (int)dataRow["vram"],
|
||||
Colors = (int)dataRow["colors"],
|
||||
Resolution = (string)dataRow["res"],
|
||||
SoundSynth = (int)dataRow["sound_synth"],
|
||||
MusicSynth = (int)dataRow["music_synth"],
|
||||
SoundChannels = (int)dataRow["sound_channels"],
|
||||
MusicChannels = (int)dataRow["music_channels"],
|
||||
Hdd1 = (int)dataRow["hdd1"],
|
||||
Hdd2 = dataRow["hdd2"] == DBNull.Value ? 0 : (int)dataRow["hdd2"],
|
||||
Hdd3 = dataRow["hdd3"] == DBNull.Value ? 0 : (int)dataRow["hdd3"],
|
||||
Disk1 = (int)dataRow["disk1"],
|
||||
Cap1 = (string)dataRow["cap1"],
|
||||
Disk2 = dataRow["disk2"] == DBNull.Value ? 0 : (int)dataRow["disk2"],
|
||||
Cap2 = dataRow["cap2"] == DBNull.Value ? null : (string)dataRow["cap2"],
|
||||
Type = (MachineType)dataRow["type"]
|
||||
Id = (int)dataRow["id"],
|
||||
Company = (int)dataRow["company"],
|
||||
Year = (int)dataRow["year"],
|
||||
Model = (string)dataRow["model"],
|
||||
Ram = (int)dataRow["ram"],
|
||||
Rom = (int)dataRow["rom"],
|
||||
Vram = (int)dataRow["vram"],
|
||||
Colors = (int)dataRow["colors"],
|
||||
Resolution = (string)dataRow["res"],
|
||||
Hdd1 = (int)dataRow["hdd1"],
|
||||
Hdd2 = dataRow["hdd2"] == DBNull.Value ? 0 : (int)dataRow["hdd2"],
|
||||
Hdd3 = dataRow["hdd3"] == DBNull.Value ? 0 : (int)dataRow["hdd3"],
|
||||
Disk1 = (int)dataRow["disk1"],
|
||||
Cap1 = (string)dataRow["cap1"],
|
||||
Disk2 = dataRow["disk2"] == DBNull.Value ? 0 : (int)dataRow["disk2"],
|
||||
Cap2 = dataRow["cap2"] == DBNull.Value ? null : (string)dataRow["cap2"],
|
||||
Type = (MachineType)dataRow["type"]
|
||||
};
|
||||
|
||||
entries.Add(entry);
|
||||
|
||||
@@ -35,11 +35,14 @@ namespace Cicm.Database
|
||||
public partial class Operations
|
||||
{
|
||||
/// <summary>Last known database version</summary>
|
||||
const int DB_VERSION = 16;
|
||||
const int DB_VERSION = 17;
|
||||
/// <summary>The column with this value indicates there is no item of this type.</summary>
|
||||
public const int DB_NONE = -1;
|
||||
/// <summary>This value indicates there's no GPU, but a direct memory->display connection (a framebuffer).</summary>
|
||||
public const int DB_FRAMEBUFFER = -2;
|
||||
/// <summary>
|
||||
/// This value indicates there's no processing unit, but a direct memory connection (a framebuffer or sound
|
||||
/// buffer).
|
||||
/// </summary>
|
||||
public const int DB_SOFTWARE = -2;
|
||||
|
||||
readonly IDbConnection dbCon;
|
||||
readonly IDbCore dbCore;
|
||||
|
||||
149
Cicm.Database/Operations/SoundByMachine.cs
Normal file
149
Cicm.Database/Operations/SoundByMachine.cs
Normal file
@@ -0,0 +1,149 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : SoundByMachine.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Contains operations to manage sound.
|
||||
//
|
||||
// --[ 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;
|
||||
|
||||
namespace Cicm.Database
|
||||
{
|
||||
public partial class Operations
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all sound in machine
|
||||
/// </summary>
|
||||
/// <param name="entries">All CPUs</param>
|
||||
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||
public bool GetSoundsByMachines(out List<SoundByMachine> entries, int machineId)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine("Getting all sound synths for machine {0}...", machineId);
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
string sql = $"SELECT * FROM sound_by_machine WHERE machine = {machineId}";
|
||||
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
dbCmd.CommandText = sql;
|
||||
DataSet dataSet = new DataSet();
|
||||
dataAdapter.SelectCommand = dbCmd;
|
||||
dataAdapter.Fill(dataSet);
|
||||
|
||||
entries = SoundByMachinesFromDataTable(dataSet.Tables[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error getting sound by machine.");
|
||||
Console.WriteLine(ex);
|
||||
entries = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all machines with specified gpu
|
||||
/// </summary>
|
||||
/// <param name="entries">All CPUs</param>
|
||||
/// <returns><c>true</c> if <see cref="entries" /> is correct, <c>false</c> otherwise</returns>
|
||||
public bool GetMachinesBySound(out List<SoundByMachine> entries, int gpuId)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine("Getting all machines with sound synth {0}...", gpuId);
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
string sql = $"SELECT * FROM sound_by_machine WHERE gpu = {gpuId}";
|
||||
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
dbCmd.CommandText = sql;
|
||||
DataSet dataSet = new DataSet();
|
||||
dataAdapter.SelectCommand = dbCmd;
|
||||
dataAdapter.Fill(dataSet);
|
||||
|
||||
entries = SoundByMachinesFromDataTable(dataSet.Tables[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error getting machines by sound synth.");
|
||||
Console.WriteLine(ex);
|
||||
entries = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IDbCommand GetCommandSoundByMachine(SoundByMachine entry)
|
||||
{
|
||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||
|
||||
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param2 = dbcmd.CreateParameter();
|
||||
|
||||
param1.ParameterName = "@sound_synth";
|
||||
param2.ParameterName = "@machine";
|
||||
|
||||
param1.DbType = DbType.Int32;
|
||||
param2.DbType = DbType.Int32;
|
||||
|
||||
param1.Value = entry.SoundSynth;
|
||||
param2.Value = entry.Machine;
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
|
||||
return dbcmd;
|
||||
}
|
||||
|
||||
static List<SoundByMachine> SoundByMachinesFromDataTable(DataTable dataTable)
|
||||
{
|
||||
List<SoundByMachine> entries = new List<SoundByMachine>();
|
||||
|
||||
foreach(DataRow dataRow in dataTable.Rows)
|
||||
{
|
||||
SoundByMachine entry = new SoundByMachine
|
||||
{
|
||||
Machine = (int)dataRow["machine"],
|
||||
SoundSynth = (int)dataRow["sound_synth"]
|
||||
};
|
||||
|
||||
entries.Add(entry);
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using Cicm.Database.Schemas;
|
||||
using Console = System.Console;
|
||||
|
||||
namespace Cicm.Database
|
||||
{
|
||||
@@ -178,7 +177,9 @@ namespace Cicm.Database
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
const string SQL = "INSERT INTO sound_synths (name)" + " VALUES (@name)";
|
||||
const string SQL = "INSERT INTO sound_synths (name, company, model_code, introduced, voices, frequency, " +
|
||||
"depth, square_wave, white_noise, type) VALUES (@name, @company, @model_code, " +
|
||||
"@introduced, @voices, @frequency, @depth, @square_wave, @white_noise, @type)";
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
@@ -210,7 +211,10 @@ namespace Cicm.Database
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
string sql = "UPDATE sound_synths SET name = @name " + $"WHERE id = {entry.Id}";
|
||||
string sql = "UPDATE sound_synths SET name = @name, company = @company, model_code = @model_code, " +
|
||||
"introduced = @introduced, voices = @voices, frequency = @frequency, depth = @depth, " +
|
||||
"square_wave = @square_wave, white_noise = @white_noise, type = @type, " +
|
||||
$"WHERE id = {entry.Id}";
|
||||
|
||||
dbcmd.CommandText = sql;
|
||||
|
||||
@@ -251,26 +255,86 @@ namespace Cicm.Database
|
||||
{
|
||||
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();
|
||||
|
||||
param1.ParameterName = "@name";
|
||||
param1.ParameterName = "@name";
|
||||
param2.ParameterName = "@company";
|
||||
param3.ParameterName = "@model_code";
|
||||
param4.ParameterName = "@introduced";
|
||||
param5.ParameterName = "@voices";
|
||||
param6.ParameterName = "@frequency";
|
||||
param7.ParameterName = "@depth";
|
||||
param8.ParameterName = "@square_wave";
|
||||
param9.ParameterName = "@white_noise";
|
||||
param10.ParameterName = "@type";
|
||||
|
||||
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.Int32;
|
||||
param8.DbType = DbType.Int32;
|
||||
param9.DbType = DbType.Int32;
|
||||
param10.DbType = DbType.Int32;
|
||||
|
||||
param1.Value = entry.Name;
|
||||
param1.Value = entry.Name;
|
||||
param2.Value = entry.Company?.Id;
|
||||
param3.Value = entry.ModelCode;
|
||||
param4.Value = entry.Introduced == DateTime.MinValue ? (object)null : entry.Introduced;
|
||||
param5.Value = entry.Voices == 0 ? (object)null : entry.Voices;
|
||||
param6.Value = entry.Frequency <= 0 ? (object)null : entry.Frequency;
|
||||
param7.Value = entry.Depth == 0 ? (object)null : entry.Depth;
|
||||
param8.Value = entry.SquareWave == 0 ? (object)null : entry.SquareWave;
|
||||
param9.Value = entry.WhiteNoise == 0 ? (object)null : entry.WhiteNoise;
|
||||
param10.Value = entry.Type == 0 ? (object)null : entry.Type;
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
dbcmd.Parameters.Add(param2);
|
||||
dbcmd.Parameters.Add(param3);
|
||||
dbcmd.Parameters.Add(param4);
|
||||
dbcmd.Parameters.Add(param5);
|
||||
dbcmd.Parameters.Add(param6);
|
||||
dbcmd.Parameters.Add(param7);
|
||||
dbcmd.Parameters.Add(param8);
|
||||
dbcmd.Parameters.Add(param9);
|
||||
dbcmd.Parameters.Add(param10);
|
||||
|
||||
return dbcmd;
|
||||
}
|
||||
|
||||
static List<SoundSynth> SoundSynthFromDataTable(DataTable dataTable)
|
||||
List<SoundSynth> SoundSynthFromDataTable(DataTable dataTable)
|
||||
{
|
||||
List<SoundSynth> entries = new List<SoundSynth>();
|
||||
|
||||
foreach(DataRow dataRow in dataTable.Rows)
|
||||
{
|
||||
SoundSynth entry = new SoundSynth {Id = (int)dataRow["id"], Name = (string)dataRow["name"]};
|
||||
SoundSynth entry = new SoundSynth
|
||||
{
|
||||
Id = (int)dataRow["id"],
|
||||
Name = (string)dataRow["name"],
|
||||
ModelCode = dataRow["model_code"] == DBNull.Value ? null : (string)dataRow["model_code"],
|
||||
Voices = dataRow["voices"] == DBNull.Value ? 0 : (int)dataRow["voices"],
|
||||
Frequency = dataRow["frequency"] == DBNull.Value ? 0 : (double)dataRow["frequency"],
|
||||
Depth = dataRow["depth"] == DBNull.Value ? 0 : (int)dataRow["depth"],
|
||||
SquareWave = dataRow["square_wave"] == DBNull.Value ? 0 : (int)dataRow["square_wave"],
|
||||
WhiteNoise = dataRow["white_noise"] == DBNull.Value ? 0 : (int)dataRow["white_noise"],
|
||||
Type = dataRow["type"] == DBNull.Value ? 0 : (int)dataRow["type"],
|
||||
Company = dataRow["company"] == DBNull.Value ? null : GetCompany((int)dataRow["company"]),
|
||||
Introduced = dataRow["introduced"] == DBNull.Value
|
||||
? DateTime.MinValue
|
||||
: Convert.ToDateTime(dataRow["introduced"])
|
||||
};
|
||||
|
||||
entries.Add(entry);
|
||||
}
|
||||
|
||||
@@ -149,6 +149,11 @@ namespace Cicm.Database
|
||||
UpdateDatabaseToV16();
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
UpdateDatabaseToV17();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OptimizeDatabase();
|
||||
@@ -1063,7 +1068,7 @@ namespace Cicm.Database
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = $"INSERT INTO `gpus` (`id`, `name`) VALUES ({DB_NONE}, 'DB_NONE');\n" +
|
||||
$"INSERT INTO `gpus` (`id`, `name`) VALUES ({DB_FRAMEBUFFER}, 'DB_FRAMEBUFFER');";
|
||||
$"INSERT INTO `gpus` (`id`, `name`) VALUES ({DB_SOFTWARE}, 'DB_FRAMEBUFFER');";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
@@ -1074,7 +1079,7 @@ namespace Cicm.Database
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = $"UPDATE `computers` SET `gpu` = {DB_NONE} WHERE `gpu` = 1;\n" +
|
||||
"UPDATE `computers` SET `gpu` = NULL WHERE `gpu` = 2;\n" +
|
||||
$"UPDATE `computers` SET `gpu` = {DB_FRAMEBUFFER} WHERE `gpu` = 3;";
|
||||
$"UPDATE `computers` SET `gpu` = {DB_SOFTWARE} WHERE `gpu` = 3;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
@@ -1085,7 +1090,7 @@ namespace Cicm.Database
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = $"UPDATE `consoles` SET `gpu` = {DB_NONE} WHERE `gpu` = 1;\n" +
|
||||
"UPDATE `consoles` SET `gpu` = NULL WHERE `gpu` = 2;\n" +
|
||||
$"UPDATE `consoles` SET `gpu` = {DB_FRAMEBUFFER} WHERE `gpu` = 3;";
|
||||
$"UPDATE `consoles` SET `gpu` = {DB_SOFTWARE} WHERE `gpu` = 3;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
@@ -1694,7 +1699,7 @@ namespace Cicm.Database
|
||||
|
||||
void UpdateDatabaseToV16()
|
||||
{
|
||||
Console.WriteLine("Updating database to version 15");
|
||||
Console.WriteLine("Updating database to version 16");
|
||||
|
||||
Console.WriteLine("Creating table `gpus_by_machine`");
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
@@ -1729,8 +1734,7 @@ namespace Cicm.Database
|
||||
|
||||
param1.Value = (int)dataRow["id"];
|
||||
|
||||
const string SQL =
|
||||
"INSERT INTO gpus_by_machine (machine, gpu) VALUES (@machine, @gpu)";
|
||||
const string SQL = "INSERT INTO gpus_by_machine (machine, gpu) VALUES (@machine, @gpu)";
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
dbcmd.Parameters.Add(param2);
|
||||
@@ -1770,6 +1774,134 @@ namespace Cicm.Database
|
||||
dbCmd.Dispose();
|
||||
}
|
||||
|
||||
void UpdateDatabaseToV17()
|
||||
{
|
||||
Console.WriteLine("Updating database to version 17");
|
||||
|
||||
Console.WriteLine("Creating table `sound_by_machine`");
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = V17.SoundByMachine;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Adding new special items to table `sound_synths`");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = $"INSERT INTO `sound_synths` (`id`, `name`) VALUES ({DB_SOFTWARE}, 'DB_SOFTWARE');";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Changing sound and music synths in machine from 27 to {0}", DB_SOFTWARE);
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = $"UPDATE `machines` SET sound_synth = {DB_SOFTWARE} WHERE sound_synth = 27;\n" +
|
||||
$"UPDATE `machines` SET music_synth = {DB_SOFTWARE} WHERE music_synth = 27;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Getting all items from `machines`");
|
||||
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||
dbCmd.CommandText = "SELECT * from machines";
|
||||
DataSet dataSet = new DataSet();
|
||||
dataAdapter.SelectCommand = dbCmd;
|
||||
dataAdapter.Fill(dataSet);
|
||||
|
||||
foreach(DataRow dataRow in dataSet.Tables[0].Rows)
|
||||
{
|
||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||
|
||||
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param2 = dbcmd.CreateParameter();
|
||||
|
||||
param1.ParameterName = "@machine";
|
||||
param2.ParameterName = "@sound_synth";
|
||||
|
||||
param1.DbType = DbType.Int32;
|
||||
param2.DbType = DbType.Int32;
|
||||
|
||||
param1.Value = (int)dataRow["id"];
|
||||
|
||||
const string SQL =
|
||||
"INSERT INTO sound_by_machine (machine, sound_synth) VALUES (@machine, @sound_synth)";
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
dbcmd.Parameters.Add(param2);
|
||||
|
||||
if(dataRow["sound_synth"] != DBNull.Value && (int)dataRow["sound_synth"] != 1 &&
|
||||
(int)dataRow["sound_synth"] != 2)
|
||||
{
|
||||
param2.Value = (int)dataRow["sound_synth"];
|
||||
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
Console.WriteLine("Adding sound {0} to machine {1}", (int)param2.Value, (int)param1.Value);
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
dbcmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
if(dataRow["music_synth"] != DBNull.Value && (int)dataRow["music_synth"] != 1 &&
|
||||
(int)dataRow["music_synth"] != 2)
|
||||
{
|
||||
param2.Value = (int)dataRow["music_synth"];
|
||||
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
Console.WriteLine("Adding sound {0} to machine {1}", (int)param2.Value, (int)param1.Value);
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
dbcmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
dbcmd.Dispose();
|
||||
}
|
||||
|
||||
Console.WriteLine("Removing sound columns from table `machines`");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = "ALTER TABLE `machines` DROP FOREIGN KEY `fk_machines_sound_synth`;\n" +
|
||||
"ALTER TABLE `machines` DROP FOREIGN KEY `fk_machines_music_synth`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `sound_channels`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `music_channels`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `sound_synth`;\n" +
|
||||
"ALTER TABLE `machines` DROP COLUMN `music_synth`;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Removing old sound items `sound_synths`");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = "DELETE FROM sound_synths WHERE id = 1;\n" +
|
||||
"DELETE FROM sound_synths WHERE id = 2;\n" + "DELETE FROM sound_synths WHERE id = 27;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Setting new database version to 17...");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
dbCmd.CommandText = "INSERT INTO cicm_db (version) VALUES ('17')";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
dbCmd.Dispose();
|
||||
}
|
||||
|
||||
void OptimizeDatabase()
|
||||
{
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
|
||||
@@ -55,20 +55,12 @@ namespace Cicm.Database.Schemas
|
||||
public int Id;
|
||||
/// <summary>Model name</summary>
|
||||
public string Model;
|
||||
/// <summary>Audio channels supported by the MPU</summary>
|
||||
public int MusicChannels;
|
||||
/// <summary>ID of MPU</summary>
|
||||
public int MusicSynth;
|
||||
/// <summary>Size in kibibytes of program RAM</summary>
|
||||
public int Ram;
|
||||
/// <summary>Resolution in WxH pixels</summary>
|
||||
public string Resolution;
|
||||
/// <summary>Size in kibibytes of firmware</summary>
|
||||
public int Rom;
|
||||
/// <summary>Audio channels supported by the DSP</summary>
|
||||
public int SoundChannels;
|
||||
/// <summary>ID of DSP</summary>
|
||||
public int SoundSynth;
|
||||
/// <summary>Machine type</summary>
|
||||
public MachineType Type;
|
||||
/// <summary>Size in kibibytes for video RAM</summary>
|
||||
|
||||
41
Cicm.Database/Schemas/SoundByMachine.cs
Normal file
41
Cicm.Database/Schemas/SoundByMachine.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Computer.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// High level representation of a computer.
|
||||
//
|
||||
// --[ 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
|
||||
{
|
||||
/// <summary>Computer</summary>
|
||||
public class SoundByMachine
|
||||
{
|
||||
/// <summary>Machine ID</summary>
|
||||
public int Machine;
|
||||
/// <summary>Sound synth ID</summary>
|
||||
public int SoundSynth;
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,34 @@
|
||||
// Copyright © 2003-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Cicm.Database.Schemas
|
||||
{
|
||||
/// <summary>Sound synthetizer</summary>
|
||||
public class SoundSynth
|
||||
{
|
||||
/// <summary>Company</summary>
|
||||
public Company Company;
|
||||
/// <summary>Sample rate in bits of the generate sound</summary>
|
||||
public int Depth;
|
||||
/// <summary>Frequency in Hz of the generated sound</summary>
|
||||
public double Frequency;
|
||||
/// <summary>ID</summary>
|
||||
public int Id;
|
||||
/// <summary>Datetime of introduction</summary>
|
||||
public DateTime Introduced;
|
||||
/// <summary>Model/SKU code</summary>
|
||||
public string ModelCode;
|
||||
/// <summary>Name</summary>
|
||||
public string Name;
|
||||
/// <summary>Simultaneous square wave generators</summary>
|
||||
public int SquareWave;
|
||||
/// <summary>Type of sound synthetizer</summary>
|
||||
public int Type;
|
||||
/// <summary>Simultaneous voices that can be generated</summary>
|
||||
public int Voices;
|
||||
/// <summary>Simultaneous white noise generators</summary>
|
||||
public int WhiteNoise;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ namespace Cicm.Database.Schemas.Sql
|
||||
public static readonly string Gpus =
|
||||
V11.Gpus + "\n" +
|
||||
$"INSERT INTO `gpus` (`id`, `name`) VALUES ({Operations.DB_NONE}, `DB_NONE`);\n" +
|
||||
$"INSERT INTO `gpus` (`id`, `name`) VALUES ({Operations.DB_FRAMEBUFFER}, `DB_FRAMEBUFFER`);";
|
||||
$"INSERT INTO `gpus` (`id`, `name`) VALUES ({Operations.DB_SOFTWARE}, `DB_FRAMEBUFFER`);";
|
||||
|
||||
public static readonly string Logs = V11.Logs;
|
||||
|
||||
|
||||
135
Cicm.Database/Schemas/Sql/V17.cs
Normal file
135
Cicm.Database/Schemas/Sql/V17.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : V17.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 V17
|
||||
{
|
||||
public static readonly string Admins = V16.Admins;
|
||||
|
||||
public static readonly string BrowserTests = V16.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" +
|
||||
"INSERT INTO cicm_db (version) VALUES ('17');";
|
||||
|
||||
public static readonly string Companies = V16.Companies;
|
||||
|
||||
public static readonly string Machines = "CREATE TABLE `machines` (;\n" +
|
||||
"`id` int(11) NOT NULL AUTO_INCREMENT,;\n" +
|
||||
"`company` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`year` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`model` char(50) NOT NULL DEFAULT '',;\n" +
|
||||
"`ram` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`rom` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`vram` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`colors` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`res` char(10) NOT NULL DEFAULT '',;\n" +
|
||||
"`hdd1` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`hdd2` int(11) DEFAULT NULL,;\n" +
|
||||
"`hdd3` int(11) DEFAULT NULL,;\n" +
|
||||
"`disk1` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"`cap1` char(25) NOT NULL DEFAULT '0',;\n" +
|
||||
"`disk2` int(11) DEFAULT NULL,;\n" +
|
||||
"`cap2` char(25) DEFAULT NULL,;\n" +
|
||||
"`type` int(11) NOT NULL DEFAULT '0',;\n" +
|
||||
"PRIMARY KEY (`id`),;\n" +
|
||||
"KEY `idx_machines_company` (`company`),;\n" +
|
||||
"KEY `idx_machines_year` (`year`),;\n" +
|
||||
"KEY `idx_machines_model` (`model`),;\n" +
|
||||
"KEY `idx_machines_ram` (`ram`),;\n" +
|
||||
"KEY `idx_machines_rom` (`rom`),;\n" +
|
||||
"KEY `idx_machines_vram` (`vram`),;\n" +
|
||||
"KEY `idx_machines_colors` (`colors`),;\n" +
|
||||
"KEY `idx_machines_res` (`res`),;\n" +
|
||||
"KEY `idx_machines_hdd1` (`hdd1`),;\n" +
|
||||
"KEY `idx_machines_hdd2` (`hdd2`),;\n" +
|
||||
"KEY `idx_machines_hdd3` (`hdd3`),;\n" +
|
||||
"KEY `idx_machines_disk1` (`disk1`),;\n" +
|
||||
"KEY `idx_machines_disk2` (`disk2`),;\n" +
|
||||
"KEY `idx_machines_cap1` (`cap1`),;\n" +
|
||||
"KEY `idx_machines_cap2` (`cap2`),;\n" +
|
||||
"KEY `idx_machines_type` (`type`));";
|
||||
|
||||
public static readonly string DiskFormats = V16.DiskFormats;
|
||||
|
||||
public static readonly string Forbidden = V16.Forbidden;
|
||||
|
||||
public static readonly string Gpus = V16.Gpus;
|
||||
|
||||
public static readonly string Logs = V16.Logs;
|
||||
|
||||
public static readonly string MoneyDonations = V16.MoneyDonations;
|
||||
|
||||
public static readonly string News = V16.News;
|
||||
|
||||
public static readonly string OwnedComputers = V16.OwnedComputers;
|
||||
|
||||
public static readonly string OwnedConsoles = V16.OwnedConsoles;
|
||||
|
||||
public static readonly string Processors = V16.Processors;
|
||||
|
||||
public static readonly string SoundSynths = V16.SoundSynths;
|
||||
|
||||
public static readonly string MachinesForeignKeys = V16.MachinesForeignKeys;
|
||||
|
||||
public static readonly string Iso3166Numeric = V16.Iso3166Numeric;
|
||||
|
||||
public static readonly string Iso3166NumericValues = V16.Iso3166NumericValues;
|
||||
|
||||
public static readonly string CompaniesForeignKeys = V16.CompaniesForeignKeys;
|
||||
|
||||
public static readonly string CompanyLogos = V16.CompanyLogos;
|
||||
|
||||
public static readonly string CompanyDescriptions = V16.CompanyDescriptions;
|
||||
|
||||
public static readonly string InstructionSets = V16.InstructionSets;
|
||||
|
||||
public static readonly string InstructionSetExtensions = V16.InstructionSetExtensions;
|
||||
|
||||
public static readonly string InstructionSetExtensionsByProcessor = V16.InstructionSetExtensionsByProcessor;
|
||||
|
||||
public static readonly string ProcessorsByMachine = V16.ProcessorsByMachine;
|
||||
|
||||
public static readonly string GpusByMachine = V16.GpusByMachine;
|
||||
|
||||
public static readonly string SoundByMachine =
|
||||
"CREATE TABLE `sound_by_machine` (\n" +
|
||||
"`sound_synth` INT NOT NULL, \n" +
|
||||
"`machine` INT NOT NULL,\n" +
|
||||
"KEY `idx_sound_by_machine_sound_synth` (`sound_synth`),\n" +
|
||||
"KEY `idx_sound_by_machine_machine` (`machine`),\n" +
|
||||
"CONSTRAINT `fk_sound_by_machine_machine` FOREIGN KEY (`machine`) REFERENCES `machines` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,\n" +
|
||||
"CONSTRAINT `fk_sound_by_machine_sound_synth` FOREIGN KEY (`sound_synth`) REFERENCES `sound_synths` (`id`) ON UPDATE CASCADE ON DELETE CASCADE);";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user