Ejemplo n.º 1
0
 public object ExecuteSqlScalar(IDbTransaction Transaction, string dbName, string SQL, bool useMaster)
 {
     if (Transaction == null)
     {
         return(SQLiteExecuter.ExecuteSqlScalar(GetConnectionString(dbName, useMaster), SQL));
     }
     else
     {
         return(SQLiteExecuter.ExecuteSqlScalar((SqliteTransaction)Transaction, SQL));
     }
 }
Ejemplo n.º 2
0
 public object ExecuteCommandScalar(IDbTransaction Transaction, string dbName, IDbCommand dbCommand, bool useMaster)
 {
     if (Transaction == null)
     {
         return(SQLiteExecuter.ExecuteCommandScalar(GetConnectionString(dbName, useMaster), dbCommand));
     }
     else
     {
         return(SQLiteExecuter.ExecuteCommandScalar((SqliteTransaction)Transaction, dbCommand));
     }
 }
Ejemplo n.º 3
0
 public int ExecuteSqlNonQuery(IDbTransaction Transaction, string dbName, string SQL)
 {
     if (Transaction == null)
     {
         return(SQLiteExecuter.ExecuteSqlNonQuery(GetConnectionString(dbName, true), SQL));
     }
     else
     {
         return(SQLiteExecuter.ExecuteSqlNonQuery((SqliteTransaction)Transaction, SQL));
     }
 }
Ejemplo n.º 4
0
 public int ExecuteCommandNonQuery(IDbTransaction Transaction, string dbName, IDbCommand dbCommand)
 {
     if (Transaction == null)
     {
         return(SQLiteExecuter.ExecuteCommandNonQuery(GetConnectionString(dbName, true), dbCommand));
     }
     else
     {
         return(SQLiteExecuter.ExecuteCommandNonQuery((SqliteTransaction)Transaction, dbCommand));
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// ExecuteCommandScalarAsync
 /// </summary>
 /// <param name="Transaction"></param>
 /// <param name="dbName"></param>
 /// <param name="dbCommand"></param>
 /// <param name="useMaster"></param>
 /// <returns></returns>
 /// <exception cref="DatabaseException"></exception>
 public Task <object> ExecuteCommandScalarAsync(IDbTransaction?Transaction, string dbName, IDbCommand dbCommand, bool useMaster = false)
 {
     if (Transaction == null)
     {
         return(SQLiteExecuter.ExecuteCommandScalarAsync(GetConnectionString(dbName, useMaster), dbCommand));
     }
     else
     {
         return(SQLiteExecuter.ExecuteCommandScalarAsync((SqliteTransaction)Transaction, dbCommand));
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// ExecuteCommandScalarAsync
        /// </summary>
        /// <param name="Transaction"></param>
        /// <param name="dbName"></param>
        /// <param name="engineCommand"></param>
        /// <param name="useMaster"></param>
        /// <returns></returns>
        /// <exception cref="DatabaseException"></exception>
        public async Task <object?> ExecuteCommandScalarAsync(IDbTransaction?Transaction, string dbName, EngineCommand engineCommand, bool useMaster = false)
        {
            using SqliteCommand dbCommand = CreateTextCommand(engineCommand);

            if (Transaction == null)
            {
                return(await SQLiteExecuter.ExecuteCommandScalarAsync(GetConnectionString(dbName, useMaster), dbCommand).ConfigureAwait(false));
            }
            else
            {
                return(await SQLiteExecuter.ExecuteCommandScalarAsync((SqliteTransaction)Transaction, dbCommand).ConfigureAwait(false));
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// ExecuteCommandNonQueryAsync
        /// </summary>
        /// <param name="Transaction"></param>
        /// <param name="dbName"></param>
        /// <param name="engineCommand"></param>
        /// <returns></returns>
        /// <exception cref="DatabaseException"></exception>
        public async Task <int> ExecuteCommandNonQueryAsync(IDbTransaction?Transaction, string dbName, EngineCommand engineCommand)
        {
            using SqliteCommand dbCommand = CreateTextCommand(engineCommand);

            if (Transaction == null)
            {
                return(await SQLiteExecuter.ExecuteCommandNonQueryAsync(GetConnectionString(dbName, true), dbCommand).ConfigureAwait(false));
            }
            else
            {
                return(await SQLiteExecuter.ExecuteCommandNonQueryAsync((SqliteTransaction)Transaction, dbCommand).ConfigureAwait(false));
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// ExecuteCommandReaderAsync
        /// </summary>
        /// <param name="Transaction"></param>
        /// <param name="dbName"></param>
        /// <param name="engineCommand"></param>
        /// <param name="useMaster"></param>
        /// <returns></returns>
        /// <exception cref="DatabaseException"></exception>
        public async Task <IDataReader> ExecuteCommandReaderAsync(IDbTransaction?Transaction, string dbName, EngineCommand engineCommand, bool useMaster = false)
        {
            //使用using的话,会同时关闭reader.
            //在Microsoft.Data.Sqlite实现中, dipose connection后,会自动dispose command
#pragma warning disable CA2000 // Dispose objects before losing scope
            SqliteCommand dbCommand = CreateTextCommand(engineCommand);
#pragma warning restore CA2000 // Dispose objects before losing scope

            if (Transaction == null)
            {
                return(await SQLiteExecuter.ExecuteCommandReaderAsync(GetConnectionString(dbName, useMaster), dbCommand).ConfigureAwait(false));
            }
            else
            {
                return(await SQLiteExecuter.ExecuteCommandReaderAsync((SqliteTransaction)Transaction, dbCommand).ConfigureAwait(false));
            }
        }