change the algorithm for manipulating multiple meta query

git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@948014 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
kjmtsh 2014-07-14 08:46:32 +00:00
parent e5f495a745
commit 61e6960b40
16 changed files with 5853 additions and 5867 deletions

1
db.php
View File

@ -34,7 +34,6 @@ if (!defined('ABSPATH')) { // Oh, you are not WordPress!
if (defined('USE_MYSQL') && USE_MYSQL) return; if (defined('USE_MYSQL') && USE_MYSQL) return;
function pdo_log_error($message, $data = null) { function pdo_log_error($message, $data = null) {
if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) { if (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin') !== false) {
$admin_dir = ''; $admin_dir = '';
} else { } else {

View File

@ -172,7 +172,6 @@ class PDOSQLiteUDFS {
//convert to ISO time //convert to ISO time
$date = date("Y-m-d H:i:s", $field); $date = date("Y-m-d H:i:s", $field);
//now submit to dateformat //now submit to dateformat
return is_null($format) ? $date : $self->dateformat($date, $format); return is_null($format) ? $date : $self->dateformat($date, $format);
} }
/** /**
@ -342,7 +341,6 @@ class PDOSQLiteUDFS {
$type .= 's'; $type .= 's';
} }
return "$_parts[0] $_parts[1]"; return "$_parts[0] $_parts[1]";
break;
case "minute_second": case "minute_second":
list($minutes, $seconds) = explode (':', $_parts[0]); list($minutes, $seconds) = explode (':', $_parts[0]);
$minutes = intval($minutes); $minutes = intval($minutes);
@ -350,8 +348,6 @@ class PDOSQLiteUDFS {
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute"; $minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second"; $seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
return "$minutes $seconds"; return "$minutes $seconds";
break;
case "hour_second": case "hour_second":
list($hours, $minutes, $seconds) = explode (':', $_parts[0]); list($hours, $minutes, $seconds) = explode (':', $_parts[0]);
$hours = intval($hours); $hours = intval($hours);
@ -361,7 +357,6 @@ class PDOSQLiteUDFS {
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute"; $minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second"; $seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
return "$hours $minutes $seconds"; return "$hours $minutes $seconds";
break;
case "hour_minute": case "hour_minute":
list($hours, $minutes) = explode (':', $_parts[0]); list($hours, $minutes) = explode (':', $_parts[0]);
$hours = intval($hours); $hours = intval($hours);
@ -369,7 +364,6 @@ class PDOSQLiteUDFS {
$hours = ($hours > 1) ? "$hours hours" : "$hours hour"; $hours = ($hours > 1) ? "$hours hours" : "$hours hour";
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute"; $minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
return "$hours $minutes"; return "$hours $minutes";
break;
case "day_second": case "day_second":
$days = intval($_parts[0]); $days = intval($_parts[0]);
list($hours, $minutes, $seconds) = explode (':', $_parts[1]); list($hours, $minutes, $seconds) = explode (':', $_parts[1]);
@ -381,7 +375,6 @@ class PDOSQLiteUDFS {
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute"; $minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
$seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second"; $seconds = ($seconds > 1) ? "$seconds seconds" : "$seconds second";
return "$days $hours $minutes $seconds"; return "$days $hours $minutes $seconds";
break;
case "day_minute": case "day_minute":
$days = intval($_parts[0]); $days = intval($_parts[0]);
list($hours, $minutes) = explode (':', $_parts[1]); list($hours, $minutes) = explode (':', $_parts[1]);
@ -391,14 +384,12 @@ class PDOSQLiteUDFS {
$hours = ($hours > 1) ? "$hours hours" : "$hours hour"; $hours = ($hours > 1) ? "$hours hours" : "$hours hour";
$minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute"; $minutes = ($minutes > 1) ? "$minutes minutes" : "$minutes minute";
return "$days $hours $minutes"; return "$days $hours $minutes";
break;
case "day_hour": case "day_hour":
$days = intval($_parts[0]); $days = intval($_parts[0]);
$hours = intval($_parts[1]); $hours = intval($_parts[1]);
$days = $days > 1 ? "$days days" : "$days day"; $days = $days > 1 ? "$days days" : "$days day";
$hours = ($hours > 1) ? "$hours hours" : "$hours hour"; $hours = ($hours > 1) ? "$hours hours" : "$hours hour";
return "$days $hours"; return "$days $hours";
break;
case "year_month": case "year_month":
list($years, $months) = explode ('-', $_parts[0]); list($years, $months) = explode ('-', $_parts[0]);
$years = intval($years); $years = intval($years);
@ -406,7 +397,6 @@ class PDOSQLiteUDFS {
$years = ($years > 1) ? "$years years" : "$years year"; $years = ($years > 1) ? "$years years" : "$years year";
$months = ($months > 1) ? "$months months": "$months month"; $months = ($months > 1) ? "$months months": "$months month";
return "$years $months"; return "$years $months";
break;
default: default:
return false; return false;
} }
@ -707,8 +697,8 @@ class PDOSQLiteUDFS {
* @return string representing the version number: major_version.minor_version * @return string representing the version number: major_version.minor_version
*/ */
public function version() { public function version() {
// global $required_mysql_version; //global $required_mysql_version;
// return $required_mysql_version; //return $required_mysql_version;
return '5.5'; return '5.5';
} }
} }

View File

@ -342,34 +342,27 @@ class PDOSQLiteUDFS {
case "minute_second": case "minute_second":
list($minutes, $seconds) = explode(':', $_parts[0]); list($minutes, $seconds) = explode(':', $_parts[0]);
return 'PT' . $minutes . 'M' . $seconds . 'S'; return 'PT' . $minutes . 'M' . $seconds . 'S';
break;
case "hour_second": case "hour_second":
list($hours, $minutes, $seconds) = explode (':', $_parts[0]); list($hours, $minutes, $seconds) = explode (':', $_parts[0]);
return 'PT' . $hours . 'H' . $minutes . 'M' . $seconds . 'S'; return 'PT' . $hours . 'H' . $minutes . 'M' . $seconds . 'S';
break;
case "hour_minute": case "hour_minute":
list($hours, $minutes) = explode (':', $_parts[0]); list($hours, $minutes) = explode (':', $_parts[0]);
return 'PT' . $hours . 'H' . $minutes . 'M'; return 'PT' . $hours . 'H' . $minutes . 'M';
break;
case "day_second": case "day_second":
$days = intval($_parts[0]); $days = intval($_parts[0]);
list($hours, $minutes, $seconds) = explode (':', $_parts[1]); list($hours, $minutes, $seconds) = explode (':', $_parts[1]);
return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M' . $seconds . 'S'; return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M' . $seconds . 'S';
break;
case "day_minute": case "day_minute":
$days = intval($_parts[0]); $days = intval($_parts[0]);
list($hours, $minutes) = explode(':', $parts[1]); list($hours, $minutes) = explode(':', $parts[1]);
return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M'; return 'P' . $days . 'D' . 'T' . $hours . 'H' . $minutes . 'M';
break;
case "day_hour": case "day_hour":
$days = intval($_parts[0]); $days = intval($_parts[0]);
$hours = intval($_parts[1]); $hours = intval($_parts[1]);
return 'P' . $days . 'D' . 'T' . $hours . 'H'; return 'P' . $days . 'D' . 'T' . $hours . 'H';
break;
case "year_month": case "year_month":
list($years, $months) = explode ('-', $_parts[0]); list($years, $months) = explode ('-', $_parts[0]);
return 'P' . $years . 'Y' . $months . 'M'; return 'P' . $years . 'Y' . $months . 'M';
break;
} }
} }
/** /**
@ -590,7 +583,6 @@ class PDOSQLiteUDFS {
$unsigned_int_data = sprintf('%u', $address); $unsigned_int_data = sprintf('%u', $address);
return $unsigned_int_data; return $unsigned_int_data;
} }
/** /**
* Method to emulate MySQL DATEDIFF() function. * Method to emulate MySQL DATEDIFF() function.
* *
@ -680,8 +672,8 @@ class PDOSQLiteUDFS {
* @return string representing the version number: major_version.minor_version * @return string representing the version number: major_version.minor_version
*/ */
public function version() { public function version() {
// global $required_mysql_version; //global $required_mysql_version;
// return $required_mysql_version; //return $required_mysql_version;
return '5.5'; return '5.5';
} }
} }

View File

@ -251,7 +251,7 @@ class PDODB extends wpdb {
} }
if (preg_match('/^\\s*(create|alter|truncate|drop|optimize)\\s*/i', $query)) { if (preg_match('/^\\s*(create|alter|truncate|drop|optimize)\\s*/i', $query)) {
// $return_val = $this->result; //$return_val = $this->result;
$return_val = $this->dbh->get_return_value(); $return_val = $this->dbh->get_return_value();
} elseif (preg_match('/^\\s*(insert|delete|update|replace)\s/i', $query)) { } elseif (preg_match('/^\\s*(insert|delete|update|replace)\s/i', $query)) {
$this->rows_affected = $this->dbh->get_affected_rows(); $this->rows_affected = $this->dbh->get_affected_rows();
@ -323,8 +323,8 @@ class PDODB extends wpdb {
* @see wpdb::db_version() * @see wpdb::db_version()
*/ */
function db_version() { function db_version() {
// global $required_mysql_version; //global $required_mysql_version;
// return $required_mysql_version; //return $required_mysql_version;
return '5.5'; return '5.5';
} }
} }

View File

@ -327,9 +327,9 @@ class PDOEngine extends PDO {
if (!is_null($this->found_rows_result)) { if (!is_null($this->found_rows_result)) {
$this->num_rows = $this->found_rows_result; $this->num_rows = $this->found_rows_result;
$_column['FOUND_ROWS()'] = $this->num_rows; $_column['FOUND_ROWS()'] = $this->num_rows;
// foreach ($this->found_rows_result[0] as $key => $value) { //foreach ($this->found_rows_result[0] as $key => $value) {
// $_column['FOUND_ROWS()'] = $value; //$_column['FOUND_ROWS()'] = $value;
// } //}
$column[] = new ObjectArray($_column); $column[] = new ObjectArray($_column);
$this->results = $column; $this->results = $column;
$this->found_rows_result = null; $this->found_rows_result = null;
@ -495,7 +495,7 @@ class PDOEngine extends PDO {
} }
$output = '<div style="clear:both">&nbsp;</div>'; $output = '<div style="clear:both">&nbsp;</div>';
if ($this->is_error === false){ if ($this->is_error === false){
// return $output; //return $output;
return ''; return '';
} }
$output .= "<div class=\"queries\" style=\"clear:both; margin_bottom:2px; border: red dotted thin;\">Queries made or created this session were<br/>\r\n\t<ol>\r\n"; $output .= "<div class=\"queries\" style=\"clear:both; margin_bottom:2px; border: red dotted thin;\">Queries made or created this session were<br/>\r\n\t<ol>\r\n";
@ -676,7 +676,7 @@ class PDOEngine extends PDO {
case 'desc': case 'desc':
case 'check': case 'check':
case 'analyze': case 'analyze':
// case "foundrows": //case "foundrows":
$this->num_rows = count($this->_results); $this->num_rows = count($this->_results);
$this->return_value = $this->num_rows; $this->return_value = $this->num_rows;
break; break;
@ -926,7 +926,7 @@ class PDOEngine extends PDO {
$rewritten_query = $engine->rewrite_query($query); $rewritten_query = $engine->rewrite_query($query);
$reason = 0; $reason = 0;
$message = ''; $message = '';
// $queries = explode(";", $this->rewritten_query); //$queries = explode(";", $this->rewritten_query);
try { try {
$this->beginTransaction(); $this->beginTransaction();
foreach ($rewritten_query as $single_query) { foreach ($rewritten_query as $single_query) {

View File

@ -48,6 +48,12 @@ class PDOSQLiteDriver {
* @var boolean * @var boolean
*/ */
private $rewrite_between = false; private $rewrite_between = false;
/**
* Variable to check how many times rewriting BETWEEN is needed.
*
* @var integer
*/
private $num_of_rewrite_between = 0;
/** /**
* Method to rewrite a query string for SQLite to execute. * Method to rewrite a query string for SQLite to execute.
* *
@ -102,7 +108,7 @@ class PDOSQLiteDriver {
case 'update': case 'update':
//$this->safe_strip_backticks(); //$this->safe_strip_backticks();
$this->rewrite_update_ignore(); $this->rewrite_update_ignore();
// $this->_rewrite_date_sub(); //$this->_rewrite_date_sub();
$this->rewrite_limit_usage(); $this->rewrite_limit_usage();
$this->rewrite_order_by_usage(); $this->rewrite_order_by_usage();
$this->rewrite_regexp(); $this->rewrite_regexp();
@ -184,6 +190,7 @@ class PDOSQLiteDriver {
} }
if (stripos($token, 'BETWEEN') !== false) { if (stripos($token, 'BETWEEN') !== false) {
$this->rewrite_between = true; $this->rewrite_between = true;
$this->num_of_rewrite_between++;
} }
} }
} }
@ -385,7 +392,6 @@ class PDOSQLiteDriver {
* @access private * @access private
*/ */
private function handle_describe_query(){ private function handle_describe_query(){
// $this->_query = "select 1=1";
$pattern = '/^\\s*(DESCRIBE|DESC)\\s*(.*)/i'; $pattern = '/^\\s*(DESCRIBE|DESC)\\s*(.*)/i';
if (preg_match($pattern, $this->_query, $match)) { if (preg_match($pattern, $this->_query, $match)) {
$tablename = preg_replace('/[\';]/', '', $match[2]); $tablename = preg_replace('/[\';]/', '', $match[2]);
@ -429,7 +435,7 @@ class PDOSQLiteDriver {
if (stripos($opt->compile_option, 'ENABLE_UPDATE_DELETE_LIMIT') !== false) return; if (stripos($opt->compile_option, 'ENABLE_UPDATE_DELETE_LIMIT') !== false) return;
} }
if (stripos($this->_query, '(select') === false) { if (stripos($this->_query, '(select') === false) {
$this->_query = preg_replace('/\\s*ORDER\\s*BY\\s*.*$/i', '', $this->_query); $this->_query = preg_replace('/\\s+ORDER\\s+BY\\s*.*$/i', '', $this->_query);
} }
} }
/** /**
@ -619,7 +625,7 @@ class PDOSQLiteDriver {
$val = trim(array_shift($ins_data_array)); $val = trim(array_shift($ins_data_array));
$ins_data_assoc[trim($col)] = $val; $ins_data_assoc[trim($col)] = $val;
} }
// $ins_data_assoc = array_combine($col_array, $ins_array); $ins_data_assoc = array_combine($col_array, $ins_array);
$condition = ''; $condition = '';
foreach ($unique_keys_for_cond as $unique_key) { foreach ($unique_keys_for_cond as $unique_key) {
if (strpos($unique_key, ',') !== false) { if (strpos($unique_key, ',') !== false) {
@ -635,7 +641,7 @@ class PDOSQLiteDriver {
continue; continue;
} }
} }
// $condition = rtrim($condition, ' AND '); $condition = rtrim($condition, ' AND ');
} else { } else {
$col = trim($unique_key); $col = trim($unique_key);
if (isset($ins_data_assoc[$col])) { if (isset($ins_data_assoc[$col])) {
@ -653,7 +659,6 @@ class PDOSQLiteDriver {
$this->_query = 'INSERT INTO '.$table_name.' '.$insert_data; $this->_query = 'INSERT INTO '.$table_name.' '.$insert_data;
return; return;
} else { } else {
// change (col, col...) values (data, data...) to array(col=>data, col=>data...)
if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_2)) { if (preg_match('/^\((.*)\)\\s*VALUES\\s*\((.*)\)$/im', $insert_data, $match_2)) {
$col_array = explode(',', $match_2[1]); $col_array = explode(',', $match_2[1]);
$ins_array = explode(',', $match_2[2]); $ins_array = explode(',', $match_2[2]);
@ -664,8 +669,6 @@ class PDOSQLiteDriver {
$ins_array_assoc[$col] = $val; $ins_array_assoc[$col] = $val;
} }
} }
// change col = data, col = data to array(col=>data, col=>data)
// some plugins have semi-colon at the end of the query
$update_data = rtrim($update_data, ';'); $update_data = rtrim($update_data, ';');
$tmp_array = explode(',', $update_data); $tmp_array = explode(',', $update_data);
foreach ($tmp_array as $pair) { foreach ($tmp_array as $pair) {
@ -674,7 +677,6 @@ class PDOSQLiteDriver {
$value = trim($value); $value = trim($value);
$update_array_assoc[$col] = $value; $update_array_assoc[$col] = $value;
} }
// change array(col=>values(col)) to array(col=>data)
foreach ($update_array_assoc as $key => &$value) { foreach ($update_array_assoc as $key => &$value) {
if (preg_match('/^VALUES\\s*\((.*)\)$/im', $value, $match_3)) { if (preg_match('/^VALUES\\s*\((.*)\)$/im', $value, $match_3)) {
$col = trim($match_3[1]); $col = trim($match_3[1]);
@ -697,18 +699,11 @@ class PDOSQLiteDriver {
$update_strings = rtrim($update_strings, ','); $update_strings = rtrim($update_strings, ',');
$unique_where = array_unique($where_array, SORT_REGULAR); $unique_where = array_unique($where_array, SORT_REGULAR);
$where_string = ' WHERE ' . implode(' AND ', $unique_where); $where_string = ' WHERE ' . implode(' AND ', $unique_where);
// $where_string = ' WHERE ' . rtrim($where_string, ',');
$update_query = 'UPDATE ' . $table_name . ' SET ' . $update_strings . $where_string; $update_query = 'UPDATE ' . $table_name . ' SET ' . $update_strings . $where_string;
$this->_query = $update_query; $this->_query = $update_query;
} }
} }
} }
// else {
// $pattern = '/ ON DUPLICATE KEY UPDATE.*$/im';
// $replace_query = preg_replace($pattern, '', $this->_query);
// $replace_query = str_ireplace('INSERT ', 'INSERT OR REPLACE ', $replace_query);
// $this->_query = $replace_query;
// }
} }
/** /**
* Method to rewrite BETWEEN A AND B clause. * Method to rewrite BETWEEN A AND B clause.
@ -721,17 +716,17 @@ class PDOSQLiteDriver {
private function rewrite_between() { private function rewrite_between() {
if (!$this->rewrite_between) return; if (!$this->rewrite_between) return;
$pattern = '/\\s*(CAST\([^\)]+?\)|[^\\s\(]*)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s\)]*)?\\s*/ims'; $pattern = '/\\s*(CAST\([^\)]+?\)|[^\\s\(]*)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s\)]*)?\\s*/ims';
do {
if (preg_match($pattern, $this->_query, $match)) { if (preg_match($pattern, $this->_query, $match)) {
$column_name = trim($match[1]); $column_name = trim($match[1]);
$min_value = trim($match[2]); $min_value = trim($match[2]);
$max_value = trim($match[3]); $max_value = trim($match[3]);
$max_value = rtrim($max_value); $max_value = rtrim($max_value);
$replacement = " $column_name >= $min_value AND $column_name <= $max_value"; $replacement = " ($column_name >= $min_value AND $column_name <= $max_value)";
$this->_query = str_ireplace($match[0], $replacement, $this->_query); $this->_query = str_ireplace($match[0], $replacement, $this->_query);
$this->rewrite_between = false;
} }
$this->parse_query(); $this->num_of_rewrite_between--;
$this->rewrite_between(); } while ($this->num_of_rewrite_between > 0);
} }
/** /**
* Method to avoid DELETE with JOIN statement. * Method to avoid DELETE with JOIN statement.
@ -746,11 +741,22 @@ class PDOSQLiteDriver {
*/ */
private function delete_workaround() { private function delete_workaround() {
global $wpdb; global $wpdb;
// $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (option_name) WHERE o2.option_id > o1.option_id";
$pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2"; $pattern = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2";
$pattern2 = "DELETE a, b FROM $wpdb->sitemeta AS a, $wpdb->sitemeta AS b";
$rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)"; $rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)";
if (stripos($this->_query, $pattern) !== false) { if (stripos($this->_query, $pattern) !== false) {
$this->_query = $rewritten; $this->_query = $rewritten;
} else if (stripos($this->_query, $pattern2) !== false) {
$time = time();
$prep_query = "SELECT a.meta_id AS aid, b.meta_id AS bid FROM $wpdb->sitemeta AS a INNER JOIN $wpdb->sitemeta AS b ON a.meta_key='_site_transient_timeout_'||substr(b.meta_key, 17) WHERE b.meta_key='_site_transient_'||substr(a.meta_key, 25) AND a.meta_value < $time";
$_wpdb = new PDODB();
$ids = $_wpdb->get_results($prep_query);
foreach ($ids as $id) {
$ids_to_delete[] = $id->aid;
$ids_to_delete[] = $id->bid;
}
$rewritten = "DELETE FROM $wpdb->sitemeta WHERE meta_id IN (".implode(',', $ids_to_delete).")";
$this->_query = $rewritten;
} }
} }
/** /**

View File

@ -33,7 +33,7 @@ class AlterQuery {
$command = str_ireplace($match[0], '', $query); $command = str_ireplace($match[0], '', $query);
$tmp_tokens['query_type'] = trim($match[1]); $tmp_tokens['query_type'] = trim($match[1]);
$tmp_tokens['table_name'] = trim($match[2]); $tmp_tokens['table_name'] = trim($match[2]);
// $command_array = $this->split_multiple($command); //$command_array = $this->split_multiple($command);
$command_array = explode(',', $command); $command_array = explode(',', $command);
$single_command = array_shift($command_array); $single_command = array_shift($command_array);
@ -48,7 +48,6 @@ class AlterQuery {
$this->_query = 'SELECT 1=1'; $this->_query = 'SELECT 1=1';
return $this->_query; return $this->_query;
} }
// foreach ($tokens as $token) {
$command_name = strtolower($tokens['command']); $command_name = strtolower($tokens['command']);
switch ($command_name) { switch ($command_name) {
case 'add column': case 'rename to': case 'add index': case 'drop index': case 'add column': case 'rename to': case 'add index': case 'drop index':
@ -72,7 +71,6 @@ class AlterQuery {
default: default:
break; break;
} }
// }
if (!is_array($tmp_query)) { if (!is_array($tmp_query)) {
$this->_query[] = $tmp_query; $this->_query[] = $tmp_query;
} else { } else {

View File

@ -337,7 +337,7 @@ class CreateQuery{
* @return array * @return array
* @access private * @access private
*/ */
private function post_process(){ private function post_process() {
$mainquery = $this->_query; $mainquery = $this->_query;
do{ do{
$count = 0; $count = 0;

View File

@ -22,7 +22,7 @@ function make_db_sqlite() {
include_once ABSPATH . 'wp-admin/includes/schema.php'; include_once ABSPATH . 'wp-admin/includes/schema.php';
$index_array = array(); $index_array = array();
// ob_end_clean(); //ob_end_clean();
$table_schemas = wp_get_db_schema(); $table_schemas = wp_get_db_schema();
$queries = explode (";", $table_schemas); $queries = explode (";", $table_schemas);
$query_parser = new CreateQuery(); $query_parser = new CreateQuery();
@ -47,10 +47,10 @@ function make_db_sqlite() {
$index_queries = $rewritten_query; $index_queries = $rewritten_query;
$table_query = trim($table_query); $table_query = trim($table_query);
$pdo->exec($table_query); $pdo->exec($table_query);
// foreach($rewritten_query as $single_query) { //foreach($rewritten_query as $single_query) {
// $single_query = trim($single_query); // $single_query = trim($single_query);
// $pdo->exec($single_query); // $pdo->exec($single_query);
// } //}
} else { } else {
$rewritten_query = trim($rewritten_query); $rewritten_query = trim($rewritten_query);
$pdo->exec($rewritten_query); $pdo->exec($rewritten_query);

View File

@ -109,6 +109,7 @@ class SQLiteIntegration {
register_activation_hook(__FILE__, array($this, 'install')); register_activation_hook(__FILE__, array($this, 'install'));
} }
if (function_exists('register_deactivation_hook')) { if (function_exists('register_deactivation_hook')) {
;
} }
if (function_exists('register_uninstall_hook')) { if (function_exists('register_uninstall_hook')) {
register_uninstall_hook(__FILE__, array('SQLiteIntegration', 'uninstall')); register_uninstall_hook(__FILE__, array('SQLiteIntegration', 'uninstall'));
@ -268,11 +269,11 @@ class SQLiteIntegration {
*/ */
function textdomain_init() { function textdomain_init() {
global $utils; global $utils;
// $current_locale = get_locale(); //$current_locale = get_locale();
// if (!empty($current_locale)) { //if (!empty($current_locale)) {
// $moFile = dirname(__FILE__) . "/languages/sqlite-wordpress-" . $current_locale . ".mo"; // $moFile = dirname(__FILE__) . "/languages/sqlite-wordpress-" . $current_locale . ".mo";
// if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('sqlite-wordpress', $moFile); // if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('sqlite-wordpress', $moFile);
// } //}
load_plugin_textdomain($utils->text_domain, false, SQLiteDir.'/languages/'); load_plugin_textdomain($utils->text_domain, false, SQLiteDir.'/languages/');
} }