makedb: split newlines for each value and parameter

This commit is contained in:
Peter McGoron 2021-08-13 16:53:57 -04:00
parent 64b934f390
commit 51c5604f69
1 changed files with 50 additions and 14 deletions

View File

@ -5,12 +5,22 @@ let inits = "\
CREATE TABLE elements ( \
num INTEGER PRIMARY KEY NOT NULL, \
symb TEXT UNIQUE NOT NULL, \
name TEXT UNIQUE NOT NULL, mass FLOAT, \
cpk_color TEXT, e_config TEXT, e_neg FLOAT, rad FLOAT, \
ionization_e FLOAT, e_affinity FLOAT, \
oxidation TEXT, state TEXT, \
melting FLOAT, boiling FLOAT, density FLOAT, \
block TEXT, discovered INTEGER) WITHOUT ROWID; \
name TEXT UNIQUE NOT NULL, \
mass FLOAT, \
cpk_color TEXT, \
e_config TEXT, \
e_neg FLOAT, \
rad FLOAT, \
ionization_e FLOAT, \
e_affinity FLOAT, \
oxidation TEXT, \
state TEXT, \
melting FLOAT, \
boiling FLOAT, \
density FLOAT, \
block TEXT, \
discovered INTEGER \
) WITHOUT ROWID; \
CREATE TABLE searchtable ( \
name TEXT PRIMARY KEY NOT NULL, \
dat BLOB NOT NULL) WITHOUT ROWID; \
@ -40,14 +50,40 @@ let makedb db json = let open Sqlite3
in let names = ref []
in let colarr = toarr json
in let stmt = "INSERT INTO elements \
(num, symb, name, mass, cpk_color, e_config, e_neg, \
rad, ionization_e, e_affinity, oxidation, state, \
melting, boiling, density, block, discovered) VALUES \
(:AtomicNumber, :Symbol, :Name, :AtomicMass, \
:CPKHexColor, :ElectronConfiguration, \
:Electronegativity, :AtomicRadius, :IonizationEnergy, \
:ElectronAffinity, :OxidationStates, :StandardState, \
:MeltingPoint, :BoilingPoint, :Density, :GroupBlock, \
(num, \
symb, \
name, \
mass, \
cpk_color, \
e_config, \
e_neg, \
rad, \
ionization_e, \
e_affinity, \
oxidation, \
state, \
melting, \
boiling, \
density, \
block, \
discovered) \
VALUES \
(:AtomicNumber, \
:Symbol, \
:Name, \
:AtomicMass, \
:CPKHexColor, \
:ElectronConfiguration, \
:Electronegativity, \
:AtomicRadius, \
:IonizationEnergy, \
:ElectronAffinity, \
:OxidationStates, \
:StandardState, \
:MeltingPoint, \
:BoilingPoint, \
:Density, \
:GroupBlock, \
:YearDiscovered);"
|> prepare db