From 51c5604f6962b6c7514963a36cc651cce8c69255 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Fri, 13 Aug 2021 16:53:57 -0400 Subject: [PATCH] makedb: split newlines for each value and parameter --- makedb.ml | 64 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/makedb.ml b/makedb.ml index 36da842..f7eb531 100644 --- a/makedb.ml +++ b/makedb.ml @@ -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