Removed the rewriting code of the BETWEEN function. Changed some documentation.
git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@778174 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
d7f68d81a6
commit
cfc1d0b2ef
Binary file not shown.
|
@ -1364,3 +1364,18 @@ msgstr "%sのカラム"
|
|||
|
||||
msgid "Columns Info"
|
||||
msgstr "カラム情報"
|
||||
|
||||
msgid "Table Name: "
|
||||
msgstr "テーブル名"
|
||||
|
||||
msgid "Column"
|
||||
msgstr "カラム"
|
||||
|
||||
msgid "Type"
|
||||
msgstr "タイプ"
|
||||
|
||||
msgid "Null"
|
||||
msgstr "ヌル"
|
||||
|
||||
msgid "Default"
|
||||
msgstr "デフォルト"
|
||||
|
|
|
@ -34,7 +34,7 @@ class PDOEngine extends PDO {
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param array $DatabaseParams
|
||||
* @param
|
||||
*/
|
||||
function __construct() {
|
||||
$this->init();
|
||||
|
@ -79,8 +79,8 @@ class PDOEngine extends PDO {
|
|||
if ($status == 5 || $status == 6) {
|
||||
$locked = true;
|
||||
} else {
|
||||
$message = __("Database connection error!<br />", 'sqlite-integration');
|
||||
$message .= sprintf(__("Error message is: %s", 'sqlite-integration'), $err->getMessage());
|
||||
$message = 'Database connection error!<br />';
|
||||
$message .= sprintf("Error message is: %s", $err->getMessage());
|
||||
$this->set_error(__LINE__, __FUNCTION__, $message);
|
||||
return false;
|
||||
}
|
||||
|
@ -95,8 +95,8 @@ class PDOEngine extends PDO {
|
|||
try {
|
||||
$this->pdo = new PDO($dsn, null, null, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
} catch (PDOException $err) {
|
||||
$message = __("Database connection error!<br />", 'sqlite-integration');
|
||||
$message .= sprintf(__("Error message is: %s", 'sqlite-integration'), $err->getMessage());
|
||||
$message = 'Database initialization error!<br />';
|
||||
$message .= sprintf("Error message is: %s", $err->getMessage());
|
||||
$this->set_error(__LINE__, __FUNCTION__, $message);
|
||||
return false;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ class PDOEngine extends PDO {
|
|||
echo $message;
|
||||
return false;
|
||||
}
|
||||
fwrite($fh, "DENY FROM ALL");
|
||||
fwrite($fh, 'DENY FROM ALL');
|
||||
fclose($fh);
|
||||
}
|
||||
umask($u);
|
||||
|
@ -144,7 +144,7 @@ class PDOEngine extends PDO {
|
|||
* executed once while installation process
|
||||
*/
|
||||
private function make_sqlite_tables() {
|
||||
require_once PDODIR . "install.php";
|
||||
require_once PDODIR . 'install.php';
|
||||
}
|
||||
|
||||
public function query($query) {
|
||||
|
@ -252,7 +252,7 @@ class PDOEngine extends PDO {
|
|||
|
||||
ob_start();
|
||||
debug_print_backtrace();
|
||||
$output .= "<pre>" . ob_get_contents() . "</pre>";
|
||||
$output .= '<pre>' . ob_get_contents() . '</pre>';
|
||||
ob_end_clean();
|
||||
return $output;
|
||||
|
||||
|
@ -298,7 +298,7 @@ class PDOEngine extends PDO {
|
|||
}
|
||||
|
||||
private function prepare_query(){
|
||||
$this->queries[] = "Prepare:\t". $this->prepared_query;
|
||||
$this->queries[] = 'Prepare: ' . $this->prepared_query;
|
||||
$reason = 0;
|
||||
$message = '';
|
||||
$statement = null;
|
||||
|
@ -312,7 +312,7 @@ class PDOEngine extends PDO {
|
|||
} while (5 == $reason || 6 == $reason);
|
||||
|
||||
if ($reason > 0){
|
||||
$err_message = sprintf(__("Problem preparing the PDO SQL Statement. Error was: %s", 'sqlite-integration'), $message);
|
||||
$err_message = sprintf("Problem preparing the PDO SQL Statement. Error was: %s", $message);
|
||||
$this->set_error(__LINE__, __FUNCTION__, $err_message);
|
||||
}
|
||||
return $statement;
|
||||
|
@ -324,7 +324,7 @@ class PDOEngine extends PDO {
|
|||
if (!is_object($statement))
|
||||
return;
|
||||
if (count($this->extracted_variables) > 0) {
|
||||
$this->queries[] = "Executing: ". var_export($this->extracted_variables, true);
|
||||
$this->queries[] = 'Executing: ' . var_export($this->extracted_variables, true);
|
||||
do {
|
||||
if ($this->query_type == 'update' || $this->query_type == 'replace') {
|
||||
try {
|
||||
|
@ -346,7 +346,7 @@ class PDOEngine extends PDO {
|
|||
}
|
||||
} while (5 == $reason || 6 == $reason);
|
||||
} else {
|
||||
$this->queries[] = "Executing: (no parameters)\t ";
|
||||
$this->queries[] = 'Executing: (no parameters)';
|
||||
do{
|
||||
if ($this->query_type == 'update' || $this->query_type == 'replace') {
|
||||
try {
|
||||
|
@ -369,7 +369,7 @@ class PDOEngine extends PDO {
|
|||
} while (5 == $reason || 6 == $reason);
|
||||
}
|
||||
if ($reason > 0) {
|
||||
$err_message = sprintf(__("Error while executing query! Error message was: %s", 'sqlite-integration'), $message);
|
||||
$err_message = sprintf("Error while executing query! Error message was: %s", $message);
|
||||
$this->set_error(__LINE__, __FUNCTION__, $err_message);
|
||||
return false;
|
||||
} else {
|
||||
|
@ -377,32 +377,32 @@ class PDOEngine extends PDO {
|
|||
}
|
||||
//generate the results that $wpdb will want to see
|
||||
switch ($this->query_type) {
|
||||
case "insert":
|
||||
case "update":
|
||||
case "replace":
|
||||
case 'insert':
|
||||
case 'update':
|
||||
case 'replace':
|
||||
$this->last_insert_id = $this->pdo->lastInsertId();
|
||||
$this->affected_rows = $statement->rowCount();
|
||||
$this->return_value = $this->affected_rows;
|
||||
break;
|
||||
case "select":
|
||||
case "show":
|
||||
case "showcolumns":
|
||||
case "showindex":
|
||||
case "describe":
|
||||
case "desc":
|
||||
case 'select':
|
||||
case 'show':
|
||||
case 'showcolumns':
|
||||
case 'showindex':
|
||||
case 'describe':
|
||||
case 'desc':
|
||||
// case "foundrows":
|
||||
$this->num_rows = count($this->_results);
|
||||
$this->return_value = $this->num_rows;
|
||||
break;
|
||||
case "delete":
|
||||
case 'delete':
|
||||
$this->affected_rows = $statement->rowCount();
|
||||
$this->return_value = $this->affected_rows;
|
||||
break;
|
||||
case "alter":
|
||||
case "drop":
|
||||
case "create":
|
||||
case "optimize":
|
||||
case "truncate":
|
||||
case 'alter':
|
||||
case 'drop':
|
||||
case 'create':
|
||||
case 'optimize':
|
||||
case 'truncate':
|
||||
if ($this->is_error) {
|
||||
$this->return_value = false;
|
||||
} else {
|
||||
|
@ -423,7 +423,7 @@ class PDOEngine extends PDO {
|
|||
$_limit = $limit = ini_get('pcre.backtrack_limit');
|
||||
do {
|
||||
if ($limit > 10000000) {
|
||||
$message = __("The query is too big to parse properly", 'sqlite-integration');
|
||||
$message = 'The query is too big to parse properly';
|
||||
$this->set_error(__LINE__, __FUNCTION__, $message);
|
||||
break; //no point in continuing execution, would get into a loop
|
||||
} else {
|
||||
|
@ -435,7 +435,7 @@ class PDOEngine extends PDO {
|
|||
|
||||
//reset the pcre.backtrack_limist
|
||||
ini_set('pcre.backtrack_limit', $_limit);
|
||||
$this->queries[]= "With Placeholders: $query ";
|
||||
$this->queries[]= 'With Placeholders: ' . $query;
|
||||
$this->prepared_query = $query;
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ class PDOEngine extends PDO {
|
|||
private function execute_insert_query_new($query) {
|
||||
$engine = $this->prepare_engine($this->query_type);
|
||||
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
||||
$this->queries[] = "Rewritten: $this->rewritten_query";
|
||||
$this->queries[] = 'Rewritten: ' . $this->rewritten_query;
|
||||
$this->extract_variables();
|
||||
$statement = $this->prepare_query();
|
||||
$this->execute_query($statement);
|
||||
|
@ -543,7 +543,7 @@ class PDOEngine extends PDO {
|
|||
}
|
||||
$query_string = $query_prefix . ' ' . $value . $suffix;
|
||||
$this->rewritten_query = $engine->rewrite_query($query_string, $this->query_type);
|
||||
$this->queries[] = "Rewritten: $this->rewritten_query";
|
||||
$this->queries[] = 'Rewritten: ' . $this->rewritten_query;
|
||||
$this->extracted_variables = array();
|
||||
$this->extract_variables();
|
||||
if ($first) {
|
||||
|
@ -556,7 +556,7 @@ class PDOEngine extends PDO {
|
|||
}
|
||||
} else {
|
||||
$this->rewritten_query = $engine->rewrite_query($query, $this->query_type);
|
||||
$this->queries[] = "Rewritten: $this->rewritten_query";
|
||||
$this->queries[] = 'Rewritten: ' . $this->rewritten_query;
|
||||
$this->extract_variables();
|
||||
$statement = $this->prepare_query();
|
||||
$this->execute_query($statement);
|
||||
|
@ -632,7 +632,7 @@ class PDOEngine extends PDO {
|
|||
}
|
||||
}
|
||||
if ($reason > 0) {
|
||||
$err_message = sprintf(__("Problem in creating table or index. Error was: %s", 'sqlite-integration'), $message);
|
||||
$err_message = sprintf("Problem in creating table or index. Error was: %s", $message);
|
||||
$this->set_error(__LINE__, __FUNCTION__, $err_message);
|
||||
return false;
|
||||
}
|
||||
|
@ -683,7 +683,7 @@ class PDOEngine extends PDO {
|
|||
$this->query($re_query);
|
||||
}
|
||||
if ($reason > 0) {
|
||||
$err_message = sprintf(__("Problem in executing alter query. Error was: %s", 'sqlite-integration'), $message);
|
||||
$err_message = sprintf("Problem in executing alter query. Error was: %s", $message);
|
||||
$this->set_error(__LINE__, __FUNCTION__, $err_message);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class PDOSQLiteDriver {
|
|||
$this->_rewrite_regexp();
|
||||
$this->_rewrite_boolean();
|
||||
$this->_fix_date_quoting();
|
||||
$this->_rewrite_between();
|
||||
// $this->_rewrite_between();
|
||||
break;
|
||||
case 'insert':
|
||||
$this->_strip_backticks();
|
||||
|
@ -70,7 +70,7 @@ class PDOSQLiteDriver {
|
|||
$this->_rewrite_limit_usage();
|
||||
$this->_rewrite_order_by_usage();
|
||||
$this->_rewrite_regexp();
|
||||
$this->_rewrite_between();
|
||||
// $this->_rewrite_between();
|
||||
break;
|
||||
case 'delete':
|
||||
$this->_strip_backticks();
|
||||
|
@ -488,13 +488,13 @@ class PDOSQLiteDriver {
|
|||
$this->_query = $update_query;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// wordaround...
|
||||
$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;
|
||||
}
|
||||
// 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;
|
||||
// }
|
||||
}
|
||||
|
||||
private function _rewrite_between() {
|
||||
|
|
|
@ -6,7 +6,7 @@ Tags: database, SQLite, PDO
|
|||
Author: Kojima Toshiyasu
|
||||
Author URI: http://dogwood.skr.jp/
|
||||
Requires at least: 3.3
|
||||
Tested up to: 3.6
|
||||
Tested up to: 3.6.1
|
||||
Stable tag: 1.4
|
||||
License: GPLv2
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
@ -50,7 +50,8 @@ SQLite Integrationは普通の「プラグイン」ではありません。WordP
|
|||
|
||||
下の方法でコンタクトを取ってください。
|
||||
|
||||
[Support Forum](http://wordpress.org/support/plugin/sqlite-integration)にポストする。
|
||||
1. [Support Forum](http://wordpress.org/support/plugin/sqlite-integration)にポストする。
|
||||
2. [SQLite Integration(ja)のページ](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/)でメッセージを残す。
|
||||
|
||||
注意: WordPress.orgはMySQL以外のデータベースを正式にサポートしていません。だから、WordPress.orgからのサポートは得られません。フォーラムに投稿しても、回答を得ることはまずないでしょう。また、パッチをあてたプラグインを使う場合は、そのプラグインの作者からのサポートはないものと思ってください。自分でリスクを負う必要があります。
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Tags: database, SQLite, PDO
|
|||
Author: Kojima Toshiyasu
|
||||
Author URI: http://dogwood.skr.jp/
|
||||
Requires at least: 3.3
|
||||
Tested up to: 3.6
|
||||
Tested up to: 3.6.1
|
||||
Stable tag: 1.4
|
||||
License: GPLv2
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
@ -38,7 +38,7 @@ When you installed WordPress 3.6 with this plugin or your WordPress is 3.5.x, yo
|
|||
|
||||
= Features =
|
||||
|
||||
SQLite Integration is not an ordinary 'plugin'. It is used to install WordPress itself. You need to do some preparations. Please read the install section. And see more detailed instruction in the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration).
|
||||
SQLite Integration is not an ordinary 'plugin'. It is used to install WordPress itself. You need to do some preparations. Please read the install section. And see more detailed instruction in the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/).
|
||||
|
||||
Once you succeeded in installing WordPress, you can use it just like the others using MySQL. Optionally, you can activate this plugin in the installed plugins panel of the adimn dashboard, and you can see the useful information and instructions. It is not required but I recommend it.
|
||||
|
||||
|
@ -50,7 +50,8 @@ If you are using [PDO for WordPress](http://wordpress.org/extend/plugins/pdo-for
|
|||
|
||||
Please contact us with the methods below:
|
||||
|
||||
Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/).
|
||||
1. Post to [Support Forum](http://wordpress.org/support/plugin/sqlite-integration/).
|
||||
2. Visti the [SQLite Integration Page](http://dogwood.skr.jp/wordpress/sqlite-integration/) or [SQLite Integration(ja) Page](http://dogwood.skr.jp/wordpress/sqlite-integration-ja/) and leave a message.
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -304,14 +304,13 @@ class DatabaseMaintenance {
|
|||
)
|
||||
);
|
||||
if (version_compare($wp_version, '3.6', '<')) return false;
|
||||
$results = $this->sanity_check();
|
||||
$return_val = array();
|
||||
$queries = array();
|
||||
$results = $this->sanity_check();
|
||||
if ($results !== true) {
|
||||
if (!$this->maintenance_backup()) {
|
||||
$message = __('Can\'t create backup file.', $domain);
|
||||
echo $message;
|
||||
return false;
|
||||
return $message;
|
||||
}
|
||||
$tables = array_keys($results);
|
||||
foreach ($tables as $table) {
|
||||
|
@ -334,10 +333,12 @@ class DatabaseMaintenance {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
$message = __('Your database is OK. You don\'t have to restore it.', $domain);
|
||||
return $message;
|
||||
}
|
||||
if (empty($return_val)) {
|
||||
return true;
|
||||
$message = __('Your database restoration is successfully finished!', $domain);
|
||||
return $message;
|
||||
} else {
|
||||
return $return_val;
|
||||
}
|
||||
|
@ -398,8 +399,6 @@ class DatabaseMaintenance {
|
|||
} elseif (!current_user_can('manage_options')) {
|
||||
die(__('You are not allowed to access this page!', $domain));
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['page']) && $_GET['page'] == 'maintenance') : ?>
|
||||
<div class="navigation">
|
||||
<ul class="navi-menu">
|
||||
|
@ -449,7 +448,7 @@ class DatabaseMaintenance {
|
|||
wp_nonce_field('sqliteintegration-database-manip-stats');
|
||||
}
|
||||
?>
|
||||
<label for="table"/>Table Name: </label>
|
||||
<label for="table"/><?php _e('Table Name: ', $domain);?></label>
|
||||
<select name="table" id="table">
|
||||
<?php foreach ($wp_tables as $table) :?>
|
||||
<option value="<?php echo $table;?>"><?php echo $table;?></option>
|
||||
|
@ -468,7 +467,7 @@ class DatabaseMaintenance {
|
|||
die(__('You are not allowed to do this operation!', $domain));
|
||||
}
|
||||
$fix_results = $this->do_fix_database();
|
||||
if ($fix_results !== true) {
|
||||
if (is_array($fix_results)) {
|
||||
$title = '<h3>'. __('Results', $domain) . '</h3>';
|
||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||
echo $title;
|
||||
|
@ -480,10 +479,9 @@ class DatabaseMaintenance {
|
|||
echo '</div>';
|
||||
} else {
|
||||
$title = '<h3>'. __('Results', $domain) . '</h3>';
|
||||
$message = __('Your database restoration is successfully finished!', $domain);
|
||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||
echo $title;
|
||||
echo '<p>'.$message.'</p>';
|
||||
echo '<p>'.$fix_results.'</p>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
@ -525,26 +523,31 @@ class DatabaseMaintenance {
|
|||
$results = $this->show_columns();
|
||||
if (is_array($results)) {
|
||||
$title = '<h3>'. sprintf(__('Columns In %s', $domain), $_POST['table']) . '</h3>';
|
||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||
$column_header = __('Column', $domain);
|
||||
$type_header = __('Type', $domain);
|
||||
$null_header = __('Null', $domain);
|
||||
$default_header = __('Default', $domain);
|
||||
echo '<div class="wrap" id="sqlite-admin-side-wrap" style="clear: both;">';
|
||||
echo $title;
|
||||
echo '<table><thead><tr><th>Column</th><th>Type</th><th>Null</th><th>Default</th></tr></thead>';
|
||||
echo '<table class="widefat page fixed"><thead><tr><th>'. $column_header . '</th><th>'. $type_header . '</th><th>' . $null_header . '</th><th>' . $default_header . '</th></tr></thead>';
|
||||
echo '<tbody>';
|
||||
$counter = 0;
|
||||
foreach ($results as $column) {
|
||||
echo '<tr>';
|
||||
echo (($counter % 2) == 1) ? '<tr class="alt">' : '<tr>';
|
||||
echo '<td>' . $column->Field . '</td>';
|
||||
echo '<td>' . $column->Type . '</td>';
|
||||
echo '<td>' . $column->Null . '</td>';
|
||||
echo '<td>' . $column->Default . '</td>';
|
||||
echo '</tr>';
|
||||
$counter++;
|
||||
}
|
||||
echo '</tbody></table></div>';
|
||||
} else {
|
||||
$title = '<h3>'. __('Columns Info', $domain) . '</h3>';
|
||||
echo '<div class="wrap" id="sqlite-admin-side-wrap">';
|
||||
echo $title;
|
||||
echo '<ul>';
|
||||
echo $results;
|
||||
echo '</ul></div>';
|
||||
echo '<p>' . $results;
|
||||
echo '</p></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
"class":"compatible"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"Better Delete Revision",
|
||||
"compat":"No",
|
||||
"reason":"DELETE with JOIN/etc",
|
||||
"class":"incompatible"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"Better Delete Revision",
|
||||
"compat":"No",
|
||||
"reason":"DELETE with JOIN/etc",
|
||||
"class":"incompatible"
|
||||
},
|
||||
|
||||
{
|
||||
"name":"Better Related Posts",
|
||||
"compat":"No",
|
||||
|
@ -121,8 +121,8 @@
|
|||
{
|
||||
"name":"FeedWordPress",
|
||||
"compat":"Needs patch",
|
||||
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||
"reason":"MySQL specific function",
|
||||
"patch_url":"http://dogwood.skr.jp/wordpress/plugins/",
|
||||
"reason":"MySQL specific function",
|
||||
"class":"workaround"
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue