예제 #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_);
        }
예제 #3
0
        public void _addProperty <__t>(PropertyId <__t> nPropertyId)
        {
            uint propertyId_ = PropertyId <__t> ._getPropertyId();

            if (mPropertys.ContainsKey(propertyId_))
            {
                LogSingleton logSingleton_ = __singleton <LogSingleton> ._instance();

                logSingleton_._logError(@"PropertyMgr _AddProperty ContainsKey");
                throw new Exception();
            }
            mPropertys[propertyId_] = nPropertyId;
        }
예제 #4
0
        public void _pushBack(IRunnable nRunnable)
        {
            if (false == mInit)
            {
                throw new Exception();
            }
            Mission mission_ = new Mission(nRunnable);

            lock (mLock)
            {
                mMissions.Add(mission_);
            }
            LogSingleton logSingleton_ = __singleton <LogSingleton> ._instance();

            logSingleton_._logError(@"MissionPool mMissions size: " + Convert.ToString(mMissions.Count));
        }
예제 #5
0
        public SqlStatus_ _runSql(ISqlSerialize nSqlSerialize)
        {
            string          sqlCommand_      = nSqlSerialize._sqlCommand();
            SqlStatus_      sqlStatus_       = SqlStatus_.mSucess_;
            MySqlConnection mySqlConnection_ = new MySqlConnection(mConnectionString);

            try
            {
                mySqlConnection_.Open();
                MySqlCommand mySqlCommand_ = new MySqlCommand(sqlCommand_, mySqlConnection_);
                mySqlCommand_.ExecuteNonQuery();
            }
            catch (Exception exception_)
            {
                LogSingleton logSingleton_ = __singleton <LogSingleton> ._instance();

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