makedb: split newlines for each value and parameter
This commit is contained in:
parent
64b934f390
commit
51c5604f69
1 changed files with 50 additions and 14 deletions
64
makedb.ml
64
makedb.ml
|
@ -5,12 +5,22 @@ let inits = "\
|
||||||
CREATE TABLE elements ( \
|
CREATE TABLE elements ( \
|
||||||
num INTEGER PRIMARY KEY NOT NULL, \
|
num INTEGER PRIMARY KEY NOT NULL, \
|
||||||
symb TEXT UNIQUE NOT NULL, \
|
symb TEXT UNIQUE NOT NULL, \
|
||||||
name TEXT UNIQUE NOT NULL, mass FLOAT, \
|
name TEXT UNIQUE NOT NULL, \
|
||||||
cpk_color TEXT, e_config TEXT, e_neg FLOAT, rad FLOAT, \
|
mass FLOAT, \
|
||||||
ionization_e FLOAT, e_affinity FLOAT, \
|
cpk_color TEXT, \
|
||||||
oxidation TEXT, state TEXT, \
|
e_config TEXT, \
|
||||||
melting FLOAT, boiling FLOAT, density FLOAT, \
|
e_neg FLOAT, \
|
||||||
block TEXT, discovered INTEGER) WITHOUT ROWID; \
|
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 ( \
|
CREATE TABLE searchtable ( \
|
||||||
name TEXT PRIMARY KEY NOT NULL, \
|
name TEXT PRIMARY KEY NOT NULL, \
|
||||||
dat BLOB NOT NULL) WITHOUT ROWID; \
|
dat BLOB NOT NULL) WITHOUT ROWID; \
|
||||||
|
@ -40,14 +50,40 @@ let makedb db json = let open Sqlite3
|
||||||
in let names = ref []
|
in let names = ref []
|
||||||
in let colarr = toarr json
|
in let colarr = toarr json
|
||||||
in let stmt = "INSERT INTO elements \
|
in let stmt = "INSERT INTO elements \
|
||||||
(num, symb, name, mass, cpk_color, e_config, e_neg, \
|
(num, \
|
||||||
rad, ionization_e, e_affinity, oxidation, state, \
|
symb, \
|
||||||
melting, boiling, density, block, discovered) VALUES \
|
name, \
|
||||||
(:AtomicNumber, :Symbol, :Name, :AtomicMass, \
|
mass, \
|
||||||
:CPKHexColor, :ElectronConfiguration, \
|
cpk_color, \
|
||||||
:Electronegativity, :AtomicRadius, :IonizationEnergy, \
|
e_config, \
|
||||||
:ElectronAffinity, :OxidationStates, :StandardState, \
|
e_neg, \
|
||||||
:MeltingPoint, :BoilingPoint, :Density, :GroupBlock, \
|
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);"
|
:YearDiscovered);"
|
||||||
|> prepare db
|
|> prepare db
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue