コード例 #1
0
        private bool SqlTrySelect(string chromatogramID, out Peak2DArray peaks)
        {
            SQLiteCommand cmd;

            if (!currentScope.TryGetCommand("SELECT_CHROMATOGRAM_PEAKS_CMD", out cmd))
            {
                cmd = currentScope.PrepareCommand("SELECT_CHROMATOGRAM_PEAKS_CMD", "SELECT PeakArray, PeakData FROM Chromatogram WHERE ChromatogramID = @chromatogramID");
            }
            else
            {
                cmd.Parameters.Clear();
            }

            cmd.Parameters.AddWithValue("@chromatogramID", chromatogramID);

            using (SQLiteDataReader reader = cmd.ExecuteReader())
            {
                if (reader.Read())
                {
                    peaks = MzLiteJson.FromJson <Peak2DArray>(reader.GetString(0));
                    decoder.Decode(reader.GetStream(1), peaks);
                    return(true);
                }
                else
                {
                    peaks = null;
                    return(false);
                }
            }
        }
コード例 #2
0
        private bool SqlTrySelect(string chromatogramID, out Chromatogram chromatogram)
        {
            SQLiteCommand cmd;

            if (!currentScope.TryGetCommand("SELECT_CHROMATOGRAM_CMD", out cmd))
            {
                cmd = currentScope.PrepareCommand("SELECT_CHROMATOGRAM_CMD", "SELECT Description FROM Chromatogram WHERE ChromatogramID = @chromatogramID");
            }
            else
            {
                cmd.Parameters.Clear();
            }

            cmd.Parameters.AddWithValue("@chromatogramID", chromatogramID);

            string desc = cmd.ExecuteScalar() as string;

            if (desc != null)
            {
                chromatogram = MzLiteJson.FromJson <Chromatogram>(desc);
                return(true);
            }
            else
            {
                chromatogram = null;
                return(false);
            }
        }
コード例 #3
0
        private bool SqlTrySelect(string spectrumID, out MassSpectrum ms)
        {
            SQLiteCommand cmd;

            if (!currentScope.TryGetCommand("SELECT_SPECTRUM_CMD", out cmd))
            {
                cmd = currentScope.PrepareCommand("SELECT_SPECTRUM_CMD", "SELECT Description FROM Spectrum WHERE SpectrumID = @spectrumID");
            }
            else
            {
                cmd.Parameters.Clear();
            }

            cmd.Parameters.AddWithValue("@spectrumID", spectrumID);

            string desc = cmd.ExecuteScalar() as string;

            if (desc != null)
            {
                ms = MzLiteJson.FromJson <MassSpectrum>(desc);
                return(true);
            }
            else
            {
                ms = null;
                return(false);
            }
        }
コード例 #4
0
        private IEnumerable <Chromatogram> SqlSelectChromatograms(string runID)
        {
            using (SQLiteCommand cmd = currentScope.CreateCommand("SELECT Description FROM Chromatogram WHERE RunID = @runID"))
            {
                cmd.Parameters.AddWithValue("@runID", runID);

                using (SQLiteDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        yield return(MzLiteJson.FromJson <Chromatogram>(reader.GetString(0)));
                    }
                }
            }
        }
コード例 #5
0
        private bool SqlTrySelect(out MzLiteModel model)
        {
            using (SQLiteCommand cmd = currentScope.CreateCommand("SELECT Content FROM Model"))
            {
                string content = cmd.ExecuteScalar() as string;

                if (content != null)
                {
                    model = MzLiteJson.FromJson <MzLiteModel>(content);
                    return(true);
                }
                else
                {
                    model = null;
                    return(false);
                }
            }
        }