From aa897ce408473245fe68d2607c854d65bb83899b Mon Sep 17 00:00:00 2001 From: kjmtsh Date: Tue, 6 Aug 2013 14:59:31 +0000 Subject: [PATCH] change the method of rewriting ALTER query to support ADD INDEX without index name, and the method of removing index hinting to support IGNORE and FORCE git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@752352 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- query.class.php | 2 +- query_alter.class.php | 6 +++++- readme.txt | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/query.class.php b/query.class.php index 718ba4a..b3b1d39 100644 --- a/query.class.php +++ b/query.class.php @@ -286,7 +286,7 @@ class PDOSQLiteDriver { * @return void */ private function _delete_index_hints(){ - $pattern = '/use\s+index\s*\(.*?\)/i'; + $pattern = '/\\s*(use|ignore|force)\\s+index\\s*\(.*?\)/i'; $this->_query = preg_replace($pattern, '', $this->_query); } diff --git a/query_alter.class.php b/query_alter.class.php index cd0f814..1321c5c 100644 --- a/query_alter.class.php +++ b/query_alter.class.php @@ -84,7 +84,11 @@ class AlterQuery { $tokens['column_name'] = '('.trim($col_name).')'; } elseif (in_array($match_2, array('index', 'key'))) { $tokens['command'] = $match_1.' '.$match_2; - $tokens['index_name'] = $match_3; + if ($match_3 == '') { + $tokens['index_name'] = str_replace(array('(', ')'), '', $the_rest); + } else { + $tokens['index_name'] = $match_3; + } $tokens['column_name'] = trim($the_rest); } else { $tokens['command'] = $match_1.' column'; diff --git a/readme.txt b/readme.txt index 4ebe687..d356370 100644 --- a/readme.txt +++ b/readme.txt @@ -46,7 +46,7 @@ Please contact us with the methods below: Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/). -Notes: WordPress.org doesn't officially support using any other database than MySQL. So there will be no supports from WordPress.org. Even if you post to the general Forum, you have few chances to get the answer. And if you use patched plugins, you will have be no support from the plugin authors, eithter. +Notes: WordPress.org doesn't officially support using any other database than MySQL. So there will be no supports from WordPress.org. Even if you post to the general Forum, you have few chances to get the answer. And if you use patched plugins, you will have no support from the plugin authors, eithter. = Translation =