コード例 #1
0
ファイル: I3DBHelper.cs プロジェクト: ie310mu/i3go_codemaker
        public static object ExecuteScalar(IDbTransaction transaction, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters)
        {
            LogSql("ExecuteScalar", commandType, commandText, commandParameters);

            object result = null;

            if (transaction is SqlTransaction)
            {
                result = I3SqlHelper.ExecuteScalar(transaction as SqlTransaction, commandType, commandText, ToDBParamArray <SqlParameter>(commandParameters));
            }
            else if (transaction is OracleTransaction)
            {
                result = I3OracleHelper.ExecuteScalar(transaction as OracleTransaction, commandType, commandText, ToDBParamArray <OracleParameter>(commandParameters));
            }
            else
            {
                result = I3MySqlHelper.ExecuteScalar(transaction as MySqlTransaction, commandType, commandText, ToDBParamArray <MySqlParameter>(commandParameters));
            }

            LogSqlResult(result == null ? "null" : result.ToString());
            return(result);
        }
コード例 #2
0
ファイル: I3DBHelper.cs プロジェクト: ie310mu/i3go_codemaker
        public static int ExecuteNonQuery(IDbTransaction transaction, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters)
        {
            LogSql("ExecuteNonQuery", commandType, commandText, commandParameters);

            int result = I3DBUtil.INVALID_ID;

            if (transaction is OracleTransaction)
            {
                result = I3SqlHelper.ExecuteNonQuery(transaction as SqlTransaction, commandType, commandText, ToDBParamArray <SqlParameter>(commandParameters));
            }
            else if (transaction is OracleTransaction)
            {
                result = I3OracleHelper.ExecuteNonQuery(transaction as OracleTransaction, commandType, commandText, ToDBParamArray <OracleParameter>(commandParameters));
            }
            else
            {
                result = I3MySqlHelper.ExecuteNonQuery(transaction as MySqlTransaction, commandType, commandText, ToDBParamArray <MySqlParameter>(commandParameters));
            }

            LogSqlResult(result.ToString());
            return(result);
        }
コード例 #3
0
ファイル: I3DBHelper.cs プロジェクト: ie310mu/i3go_codemaker
        private static DbDataReader ExecuteReader(IDbConnection connection, IDbTransaction transaction, CommandType commandType, string commandText, IDbDataParameter[] commandParameters, I3DbConnectionOwnership connectionOwnership)
        {
            LogSql("ExecuteReader", commandType, commandText, commandParameters);

            DbDataReader reader = null;

            if (connection is SqlConnection)
            {
                reader = I3SqlHelper.ExecuteReader(connection as SqlConnection, transaction as SqlTransaction, commandType, commandText, ToDBParamArray <SqlParameter>(commandParameters), connectionOwnership);
            }
            else if (connection is OracleConnection)
            {
                reader = I3OracleHelper.ExecuteReader(connection as OracleConnection, transaction as OracleTransaction, commandType, commandText, ToDBParamArray <OracleParameter>(commandParameters), connectionOwnership);
            }
            else
            {
                reader = I3MySqlHelper.ExecuteReader(connection as MySqlConnection, transaction as MySqlTransaction, commandType, commandText, ToDBParamArray <MySqlParameter>(commandParameters), connectionOwnership);
            }

            LogSqlResult(reader.HasRows.ToString());
            return(reader);
        }
コード例 #4
0
ファイル: I3DBHelper.cs プロジェクト: ie310mu/i3go_codemaker
        public static DataSet ExecuteDataset(IDbTransaction transaction, CommandType commandType, string commandText, params IDbDataParameter[] commandParameters)
        {
            LogSql("ExecuteDataset", commandType, commandText, commandParameters);

            DataSet dataSet = null;

            if (transaction is SqlTransaction)
            {
                dataSet = I3SqlHelper.ExecuteDataset(transaction as SqlTransaction, commandType, commandText, ToDBParamArray <SqlParameter>(commandParameters));
            }
            else if (transaction is OracleTransaction)
            {
                dataSet = I3OracleHelper.ExecuteDataset(transaction as OracleTransaction, commandType, commandText, ToDBParamArray <OracleParameter>(commandParameters));
            }
            else
            {
                dataSet = I3MySqlHelper.ExecuteDataset(transaction as MySqlTransaction, commandType, commandText, ToDBParamArray <MySqlParameter>(commandParameters));
            }

            LogSqlResult(dataSet == null || dataSet.Tables.Count == 0 ? "0" : dataSet.Tables[0].Rows.Count.ToString());
            return(dataSet);
        }