refactored the sqlite databse hack for foreign keys support

This commit is contained in:
hyung-hwan 2021-09-05 15:42:11 +00:00
parent 8a82efe40b
commit 7ec6751716
4 changed files with 40 additions and 2 deletions

View File

@ -150,7 +150,9 @@ class CI_DB_driver {
return FALSE; return FALSE;
} }
return TRUE; // HYUNG-HWAN
//return TRUE;
// END HYUNG-HWAN
} }
} }
@ -161,9 +163,20 @@ class CI_DB_driver {
$this->_execute('PRAGMA foreign_keys=ON'); $this->_execute('PRAGMA foreign_keys=ON');
} }
// HYUNG-HWAN
$this->db_post_initialize ();
// END HYUNG-HWAN
return TRUE; return TRUE;
} }
// HYUNG-HWAN
function db_post_initialize ()
{
return TRUE;
}
// END HYUNG-HWAN
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/** /**

View File

@ -141,6 +141,13 @@ class CI_DB_oci8_driver extends CI_DB {
return TRUE; return TRUE;
} }
// HYUNG-HWAN
function db_post_initialize ()
{
$this->query ("ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SS.FF'");
}
// END HYUNG-HWAN
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/** /**

View File

@ -237,6 +237,17 @@ class CI_DB_pdo_driver extends CI_DB {
return TRUE; return TRUE;
} }
// HYUNG-HWAN - hack to enable foreign keys support in sqlite
function db_post_initialize ()
{
if (preg_match("/^sqlite/", $this->hostname))
{
$this->_execute('PRAGMA foreign_keys=ON');
}
}
// END HYUNG-HWAN
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/** /**

View File

@ -143,6 +143,13 @@ class CI_DB_sqlite_driver extends CI_DB {
return TRUE; return TRUE;
} }
// HYUNG-HWAN - hack to enable foreign keys support in sqlite
function db_post_initialize ()
{
$this->_execute('PRAGMA foreign_keys=ON');
}
// END HYUNG-HWAN
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/** /**