コード例 #1
0
                                         cmd.ExecuteReader(containsBlob ? CommandBehavior.KeyInfo : CommandBehavior.Default)); // Key info is needed if we want to be able to read blob data without explictly require rowid column while using an alias row; However this will also return extra fields for primary keys; However if just we specify rowID and there is an alias the returned rowID will be named as alias (e.g. ID)

        /// <summary>
        /// Execute a SQL non-query (e.g. insert and update) in a given transaction with SQLite parameters defined in an object
        /// </summary>
        public static void ExecuteSQLNonQuery(this SQLiteConnection connection, SQLiteTransaction transaction, string command, object parameters = null)
        => connection.BuildSQL(transaction, command, parameters, cmd => { cmd.ExecuteNonQuery(); return(null); });
コード例 #2
0
 /// <summary>
 /// Execute a SQL query (e.g. select) in a given transaction with SQLite parameters defined in an object
 /// </summary>
 public static SQLiteDataReader ExecuteQuery(this SQLiteConnection connection, SQLiteTransaction transaction, string command, object parameters = null, bool containsBlob = false)
 => connection.BuildSQL(transaction, command, parameters, cmd =>
                                                                                                             // Optionally we can store result to in-memory table: new DataTable().Load(reader);
                        cmd.ExecuteReader(containsBlob? CommandBehavior.KeyInfo : CommandBehavior.Default)); // Key info is needed if we want to be able to read blob data without explictly require rowid column while using an alias row; However this will also return extra fields for primary keys; However if just we specify rowID and there is an alias the returned rowID will be named as alias (e.g. ID)