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
This commit is contained in:
kjmtsh 2013-08-06 14:59:31 +00:00
parent 4147af7334
commit aa897ce408
3 changed files with 7 additions and 3 deletions

View File

@ -286,7 +286,7 @@ class PDOSQLiteDriver {
* @return void * @return void
*/ */
private function _delete_index_hints(){ 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); $this->_query = preg_replace($pattern, '', $this->_query);
} }

View File

@ -84,7 +84,11 @@ class AlterQuery {
$tokens['column_name'] = '('.trim($col_name).')'; $tokens['column_name'] = '('.trim($col_name).')';
} elseif (in_array($match_2, array('index', 'key'))) { } elseif (in_array($match_2, array('index', 'key'))) {
$tokens['command'] = $match_1.' '.$match_2; $tokens['command'] = $match_1.' '.$match_2;
if ($match_3 == '') {
$tokens['index_name'] = str_replace(array('(', ')'), '', $the_rest);
} else {
$tokens['index_name'] = $match_3; $tokens['index_name'] = $match_3;
}
$tokens['column_name'] = trim($the_rest); $tokens['column_name'] = trim($the_rest);
} else { } else {
$tokens['command'] = $match_1.' column'; $tokens['command'] = $match_1.' column';

View File

@ -46,7 +46,7 @@ Please contact us with the methods below:
Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/). 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 = = Translation =