private void SqlSave(MzLiteModel model) { using (SQLiteCommand cmd = currentScope.CreateCommand("DELETE FROM Model")) { cmd.ExecuteNonQuery(); } using (SQLiteCommand cmd = currentScope.CreateCommand("INSERT INTO Model VALUES(@lock, @content)")) { cmd.Parameters.AddWithValue("@lock", 0); cmd.Parameters.AddWithValue("@content", MzLiteJson.ToJson(model)); cmd.ExecuteNonQuery(); } }
private void SqlInsert(string runID, Chromatogram chromatogram, Peak2DArray peaks) { SQLiteCommand cmd; if (!currentScope.TryGetCommand("INSERT_CHROMATOGRAM_CMD", out cmd)) { cmd = currentScope.PrepareCommand("INSERT_CHROMATOGRAM_CMD", "INSERT INTO Chromatogram VALUES(@runID, @chromatogramID, @description, @peakArray, @peakData);"); } cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@runID", runID); cmd.Parameters.AddWithValue("@chromatogramID", chromatogram.ID); cmd.Parameters.AddWithValue("@description", MzLiteJson.ToJson(chromatogram)); cmd.Parameters.AddWithValue("@peakArray", MzLiteJson.ToJson(peaks)); cmd.Parameters.AddWithValue("@peakData", encoder.Encode(peaks)); cmd.ExecuteNonQuery(); }
private void SqlInsert(string runID, MassSpectrum spectrum, Peak1DArray peaks) { SQLiteCommand cmd; if (!currentScope.TryGetCommand("INSERT_SPECTRUM_CMD", out cmd)) { cmd = currentScope.PrepareCommand("INSERT_SPECTRUM_CMD", "INSERT INTO Spectrum VALUES(@runID, @spectrumID, @description, @peakArray, @peakData);"); } cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@runID", runID); cmd.Parameters.AddWithValue("@spectrumID", spectrum.ID); cmd.Parameters.AddWithValue("@description", MzLiteJson.ToJson(spectrum)); cmd.Parameters.AddWithValue("@peakArray", MzLiteJson.ToJson(peaks)); cmd.Parameters.AddWithValue("@peakData", encoder.Encode(peaks)); cmd.ExecuteNonQuery(); }