コード例 #1
0
        public SqlStatus_ _runSql <__t>(ISqlSerialize nSqlSerialize, List <__t> nValues) where __t : ISqlStream
        {
            string         sqlCommand_     = nSqlSerialize._sqlCommand();
            SqlStatus_     sqlStatus_      = SqlStatus_.mSucess_;
            MySqlSingleton mySqlSingleton_ = __singleton <MySqlSingleton> ._instance();

            string          connectionString_ = mySqlSingleton_._getConnectionString();
            MySqlConnection mySqlConnection_  = new MySqlConnection(connectionString_);

            try
            {
                mySqlConnection_.Open();
                MySqlCommand    mySqlCommand_    = new MySqlCommand(sqlCommand_, mySqlConnection_);
                MySqlDataReader mySqlDataReader_ = mySqlCommand_.ExecuteReader();
                if (mySqlDataReader_.Read())
                {
                    MySqlDataReaderSerialize mySqlDataReaderSerialize_ = new MySqlDataReaderSerialize(mySqlDataReader_);
                    __t t_ = Activator.CreateInstance <__t>();
                    t_._serialize(mySqlDataReaderSerialize_);
                    nValues.Add(t_);
                }
                mySqlDataReader_.Close();
            }
            catch (Exception exception_)
            {
                LogSingleton logSingleton_ = __singleton <LogSingleton> ._instance();

                logSingleton_._logError(exception_.ToString());
                sqlStatus_ = SqlStatus_.mFail_;
            }
            mySqlConnection_.Close();
            return(sqlStatus_);
        }
コード例 #2
0
        public SqlStatus_ _runSql(ISqlSerialize nSqlSerialize, ISqlSerialize nSqlSerializeEx, ISqlStream nSqlStream)
        {
            string sqlCommand_ = nSqlSerialize._sqlCommand();

            sqlCommand_ += nSqlSerializeEx._sqlCommand();
            SqlStatus_     sqlStatus_      = SqlStatus_.mSucess_;
            MySqlSingleton mySqlSingleton_ = __singleton <MySqlSingleton> ._instance();

            string          connectionString_ = mySqlSingleton_._getConnectionString();
            MySqlConnection mySqlConnection_  = new MySqlConnection(connectionString_);

            try
            {
                mySqlConnection_.Open();
                MySqlCommand    mySqlCommand_    = new MySqlCommand(sqlCommand_, mySqlConnection_);
                MySqlDataReader mySqlDataReader_ = mySqlCommand_.ExecuteReader();
                if (mySqlDataReader_.Read())
                {
                    MySqlDataReaderSerialize mySqlDataReaderSerialize_ = new MySqlDataReaderSerialize(mySqlDataReader_);
                    nSqlStream._serialize(mySqlDataReaderSerialize_);
                }
                mySqlDataReader_.Close();
            }
            catch (Exception exception_)
            {
                LogSingleton logSingleton_ = __singleton <LogSingleton> ._instance();

                logSingleton_._logError(exception_.ToString());
                sqlStatus_ = SqlStatus_.mFail_;
            }
            mySqlConnection_.Close();
            return(sqlStatus_);
        }