Autoincrement for sqlite3 (#180)

This commit is contained in:
onli 2014-06-09 21:56:43 +02:00
parent 48f820cc33
commit 7b21150c10
3 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,9 @@
Version 2.0-beta3 ()
------------------------------------------------------------------------
* Support added in serendipity_db_schema_import for sqlite
autoincrement
* Remove Google Reader button from syndication plugin options
* Add subToMe-button to syndication plugin and change its defaults

View File

@ -290,13 +290,14 @@ function &serendipity_db_query($sql, $single = false, $result_type = "both", $re
*/
function serendipity_db_schema_import($query) {
static $search = array('{AUTOINCREMENT}', '{PRIMARY}', '{UNSIGNED}', '{FULLTEXT}', '{BOOLEAN}', '{UTF_8}', '{TEXT}');
static $replace = array('INTEGER', 'PRIMARY KEY', '', '', 'BOOLEAN NOT NULL', '', 'LONGTEXT');
static $replace = array('INTEGER AUTOINCREMENT', 'PRIMARY KEY', '', '', 'BOOLEAN NOT NULL', '', 'LONGTEXT');
if (stristr($query, '{FULLTEXT_MYSQL}')) {
return true;
}
$query = trim(str_replace($search, $replace, $query));
$query = str_replace('INTEGER AUTOINCREMENT PRIMARY KEY', 'INTEGER PRIMARY KEY AUTOINCREMENT', $query);
if ($query[0] == '@') {
// Errors are expected to happen (like duplicate index creation)
return serendipity_db_query(substr($query, 1), false, 'both', false, false, false, true);

View File

@ -343,13 +343,14 @@ function serendipity_db_probe($hash, &$errs)
function serendipity_db_schema_import($query)
{
static $search = array('{AUTOINCREMENT}', '{PRIMARY}', '{UNSIGNED}', '{FULLTEXT}', '{BOOLEAN}', '{UTF_8}', '{TEXT}');
static $replace = array('INTEGER', 'PRIMARY KEY', '', '', 'BOOLEAN NOT NULL', '', 'LONGTEXT');
static $replace = array('INTEGER AUTOINCREMENT', 'PRIMARY KEY', '', '', 'BOOLEAN NOT NULL', '', 'LONGTEXT');
if (stristr($query, '{FULLTEXT_MYSQL}')) {
return true;
}
$query = trim(str_replace($search, $replace, $query));
$query = str_replace('INTEGER AUTOINCREMENT PRIMARY KEY', 'INTEGER PRIMARY KEY AUTOINCREMENT', $query);
if ($query[0] == '@') {
// Errors are expected to happen (like duplicate index creation)
return serendipity_db_query(substr($query, 1), false, 'both', false, false, false, true);