public static Error Execute(SqliteConnection _connection, string _query, ExecuteHandle _handle)
    {
        if (null == _connection)
        {
            return(new Error(1, "connection is null"));
        }

        try
        {
            //one execute will create new command and reader.
            //close them after finish.
            SqliteCommand command = _connection.CreateCommand();
            command.CommandText = _query;
            SqliteDataReader reader = command.ExecuteReader();
            _handle(reader);
            reader.Close();
            command.Cancel();
            return(Error.OK);
        }
        catch (System.Exception e)
        {
            Log.Exception("SQLiteUtility.Execute", e);
            return(new Error(2, e.Message));
        }
    }
Exemplo n.º 2
0
        public void Execute(string sql)
        {
            ExecuteHandle handle = new ExecuteHandle(ModelName);
            //handle.Execute(sql);
            SqlStatement statement = new SqlStatement(sql);

            Database.DbDriver.FormatSQL(statement);
            handle.Execute(statement);
        }
Exemplo n.º 3
0
        public void PutCommand(ExecuteHandle method)
        {
            if (!isInitialized)
            {
                Init();
            }

            var cmd = new Command();

            cmd.ExecuteHandle += method;
            commandQueue.Add(cmd);
        }