예제 #1
0
        public bool _runSqlCommand(SqlCommand nSqlCommand,
                                   ISqlHeadstream nSqlHeadstream)
        {
            bool            result           = true;
            MySqlConnection mySqlConnection_ =
                new MySqlConnection(mConnectionString);

            try {
                mySqlConnection_.Open();
                string       sqlCommand_   = nSqlCommand._sqlCommand();
                MySqlCommand mySqlCommand_ =
                    new MySqlCommand(sqlCommand_, mySqlConnection_);
                MySqlDataReader mySqlDataReader_ =
                    mySqlCommand_.ExecuteReader();
                SqlReader sqlReader_ =
                    new SqlReader(mySqlDataReader_);
                while (sqlReader_._runRead())
                {
                    nSqlHeadstream._runSelect(sqlReader_);
                }
                sqlReader_._runClose();
            } catch (MySqlException exception_) {
                LogService logService_ =
                    __singleton <LogService> ._instance();

                string logError =
                    string.Format(@"sqlError:{0},{1}",
                                  exception_.Number,
                                  exception_.Message);
                logService_._logError(logError);
                result = false;
            }
            mySqlConnection_.Close();
            return(result);
        }
예제 #2
0
 public void _runInsertUpdateEx(ISqlHeadstream nSqlHeadstream)
 {
     mValue  += @"INSERT INTO ";
     mValue  += mFieldCharacter;
     mValue  += nSqlHeadstream._tableName();
     mValue  += mFieldCharacter;
     mValue  += @" VALUES (";
     mBeg     = true;
     mSqlDeal = SqlDeal_.mInsertUpdateE_;
     nSqlHeadstream._runSelect(this);
     mValue  += @") ON DUPLICATE KEY UPDATE ";
     mBeg     = true;
     mSqlDeal = SqlDeal_.mInsertUpdateEx_;
     nSqlHeadstream._runSelect(this);
     mSqlDeal = SqlDeal_.mWhere_;
     nSqlHeadstream._runWhere(this);
     mSqlDeal = SqlDeal_.mNone_;
 }
예제 #3
0
 public void _runInsert(ISqlHeadstream nSqlHeadstream)
 {
     mValue  += @"INSERT INTO ";
     mValue  += mFieldCharacter;
     mValue  += nSqlHeadstream._tableName();
     mValue  += mFieldCharacter;
     mValue  += @" (";
     mBeg     = true;
     mSqlDeal = SqlDeal_.mSelect_;
     nSqlHeadstream._runSelect(this);
     mValue  += @") VALUES (";
     mBeg     = true;
     mSqlDeal = SqlDeal_.mInsert_;
     nSqlHeadstream._runSelect(this);
     mValue  += @") ";
     mSqlDeal = SqlDeal_.mWhere_;
     nSqlHeadstream._runWhere(this);
     mSqlDeal = SqlDeal_.mNone_;
 }
예제 #4
0
 public void _runCreate(ISqlHeadstream nSqlHeadstream)
 {
     mValue  += @"CREATE TABLE ";
     mValue  += mFieldCharacter;
     mValue  += nSqlHeadstream._tableName();
     mValue  += mFieldCharacter;
     mValue  += @"(";
     mBeg     = true;
     mSqlDeal = SqlDeal_.mCreate_;
     nSqlHeadstream._runSelect(this);
     mBeg     = true;
     mEnd     = false;
     mSqlDeal = SqlDeal_.mPrimary_;
     nSqlHeadstream._runSelect(this);
     if (mEnd)
     {
         mValue += @")";
     }
     mValue  += @")ENGINE=MYISAM DEFAULT CHARSET=utf8;";
     mSqlDeal = SqlDeal_.mNone_;
 }
예제 #5
0
 public void _runSelect(ISqlHeadstream nSqlHeadstream)
 {
     mValue  += @"SELECT ";
     mBeg     = true;
     mSqlDeal = SqlDeal_.mSelect_;
     nSqlHeadstream._runSelect(this);
     mValue  += @" FROM ";
     mValue  += mFieldCharacter;
     mValue  += nSqlHeadstream._tableName();
     mValue  += mFieldCharacter;
     mValue  += @" ";
     mSqlDeal = SqlDeal_.mWhere_;
     nSqlHeadstream._runWhere(this);
     mSqlDeal = SqlDeal_.mNone_;
 }
예제 #6
0
 public void _runUpdate(ISqlHeadstream nSqlHeadstream)
 {
     mValue  += @"UPDATE ";
     mValue  += mFieldCharacter;
     mValue  += nSqlHeadstream._tableName();
     mValue  += mFieldCharacter;
     mValue  += @" SET ";
     mBeg     = true;
     mSqlDeal = SqlDeal_.mUpdate_;
     nSqlHeadstream._runSelect(this);
     mSqlDeal = SqlDeal_.mWhere_;
     mValue  += @" ";
     nSqlHeadstream._runWhere(this);
     mSqlDeal = SqlDeal_.mNone_;
 }