refactored the sqlite databse hack for foreign keys support
This commit is contained in:
parent
8a82efe40b
commit
7ec6751716
@ -150,7 +150,9 @@ class CI_DB_driver {
|
||||
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');
|
||||
}
|
||||
|
||||
// HYUNG-HWAN
|
||||
$this->db_post_initialize ();
|
||||
// END HYUNG-HWAN
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// HYUNG-HWAN
|
||||
function db_post_initialize ()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
// END HYUNG-HWAN
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
@ -141,6 +141,13 @@ class CI_DB_oci8_driver extends CI_DB {
|
||||
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
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
@ -237,6 +237,17 @@ class CI_DB_pdo_driver extends CI_DB {
|
||||
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
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
@ -143,6 +143,13 @@ class CI_DB_sqlite_driver extends CI_DB {
|
||||
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
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -656,4 +663,4 @@ class CI_DB_sqlite_driver extends CI_DB {
|
||||
|
||||
|
||||
/* End of file sqlite_driver.php */
|
||||
/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */
|
||||
/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */
|
||||
|
Loading…
Reference in New Issue
Block a user