コード例 #1
0
 /// <summary>
 /// Execute a SQL query (e.g. select) with given command and SQLite parameters defined in a dictionary for string parameters;
 /// Useful in cases parameter name need to be procedurally generated in which case objects won't work
 /// </summary>
 public static SQLiteDataReader ExecuteQueryDictionary(this SQLiteConnection connection, SQLiteTransaction transaction, string command, Dictionary <string, object> parameters = null, bool containsBlob = false)
 => connection.BuildSQLDictionary(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)