Skip to content

Commit

Permalink
Merge pull request #173 from nanasess/fix-storage-engine
Browse files Browse the repository at this point in the history
MySQL5.7.5 以降で `SET SESSION storage_engine = InnoDB` がエラーになるのを修正
  • Loading branch information
ryo-endo committed Oct 25, 2017
2 parents 6fc2ccf + 16fb072 commit a798b56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,11 @@ public function getDummyFromClauseSql()
*/
public function initObjQuery(SC_Query &$objQuery)
{
$objQuery->exec('SET SESSION storage_engine = InnoDB');
if ($objQuery->conn->getConnection()->server_version >= 50705) {
$objQuery->exec('SET SESSION default_storage_engine = InnoDB');
} else {
$objQuery->exec('SET SESSION storage_engine = InnoDB');
}
$objQuery->exec("SET SESSION sql_mode = 'ANSI'");
}
}
8 changes: 6 additions & 2 deletions html/install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,12 @@ function lfExecuteSQL($filepath, $arrDsn, $disp_err = true)

// MySQL 用の初期化
// XXX SC_Query を使うようにすれば、この処理は不要となる
if ($arrDsn['phptype'] === 'mysql') {
$objDB->exec('SET SESSION storage_engine = InnoDB');
if ($arrDsn['phptype'] === 'mysqli') {
if ($objDB->getConnection()->server_version >= 50705) {
$objDB->exec('SET SESSION defaut_storage_engine = InnoDB');
} else {
$objDB->exec('SET SESSION storage_engine = InnoDB');
}
$objDB->exec("SET SESSION sql_mode = 'ANSI'");
}

Expand Down

0 comments on commit a798b56

Please sign in to comment.