예제 #1
0
        public int DropTable()
        {
            LinterDbCommand command = connection.CreateCommand();

            command.CommandText = String.Format(
                "DROP TABLE {0} ", name);
            return(command.ExecuteNonQuery());
        }
예제 #2
0
        public void Delete(long from, long to)
        {
            LinterDbCommand command = connection.CreateCommand();

            command.CommandText = String.Format(
                "DELETE FROM {0} " +
                "WHERE ID >= {1} AND ID <= {2}", name, from, to);
            command.ExecuteNonQuery();
        }
예제 #3
0
        public void Delete(long key)
        {
            LinterDbCommand command = connection.CreateCommand();

            command.CommandText = String.Format(
                "DELETE FROM {0} " +
                "WHERE ID = {1}", name, key);
            command.ExecuteNonQuery();
        }
예제 #4
0
        public void Write(IEnumerable <KeyValuePair <long, Tick> > records)
        {
            lock (SyncRoot)
            {
                foreach (KeyValuePair <long, Tick> kv in records)
                {
                    long key  = kv.Key;
                    Tick tick = kv.Value;

                    writeCommand.Parameters[0].Value = key;
                    writeCommand.Parameters[1].Value = tick.Symbol;
                    writeCommand.Parameters[2].Value = tick.Timestamp;
                    writeCommand.Parameters[3].Value = tick.Bid;
                    writeCommand.Parameters[4].Value = tick.Ask;
                    writeCommand.Parameters[5].Value = tick.BidSize;
                    writeCommand.Parameters[6].Value = tick.AskSize;
                    writeCommand.Parameters[7].Value = tick.Provider;

                    writeCommand.ExecuteNonQuery();
                }
            }
        }
예제 #5
0
        public int CreateTable()
        {
            LinterDbCommand command = connection.CreateCommand();

            command.CommandText = String.Format(
                "CREATE OR REPLACE TABLE {0} (", name) +
                                  "ID bigint primary key," +
                                  "Symbol varchar(255)," +
                                  "Time date," +
                                  "Bid double," +
                                  "Ask double," +
                                  "BidSize int," +
                                  "AskSize int," +
                                  "Provider varchar(255))";
            return(command.ExecuteNonQuery());
        }