/// <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(MySQLExecuter.ExecuteCommandScalarAsync(GetConnectionString(dbName, useMaster), dbCommand));
     }
     else
     {
         return(MySQLExecuter.ExecuteCommandScalarAsync((MySqlTransaction)Transaction, dbCommand));
     }
 }
Exemple #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 MySqlCommand command = CreateTextCommand(engineCommand);

            if (Transaction == null)
            {
                return(await MySQLExecuter.ExecuteCommandScalarAsync(GetConnectionString(dbName, useMaster), command).ConfigureAwait(false));
            }
            else
            {
                return(await MySQLExecuter.ExecuteCommandScalarAsync((MySqlTransaction)Transaction, command).ConfigureAwait(false));
            }
        }