/// <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));
     }
 }
Beispiel #2
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));
            }
        }