Add support for UNIX_TIMESTAMP

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@195515 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2010-01-19 20:05:57 +00:00
parent 479270637b
commit f01c515d86
2 changed files with 5 additions and 0 deletions

View File

@@ -151,6 +151,10 @@
$pattern = '/DATE_ADD[ ]*\(([^,]+),([^\)]+)\)/'; $pattern = '/DATE_ADD[ ]*\(([^,]+),([^\)]+)\)/';
$sql = preg_replace( $pattern, '($1 + $2)', $sql); $sql = preg_replace( $pattern, '($1 + $2)', $sql);
// UNIX_TIMESTAMP in MYSQL returns an integer
$pattern = '/UNIX_TIMESTAMP\(([^\)])\)';
$sql = preg_replace( $pattern, 'ROUND(DATE_PART(\'epoch\',$1))', $sql);
$date_funcs = array( $date_funcs = array(
'YEAR(' => 'EXTRACT(YEAR FROM ', 'YEAR(' => 'EXTRACT(YEAR FROM ',
'MONTH(' => 'EXTRACT(MONTH FROM ', 'MONTH(' => 'EXTRACT(MONTH FROM ',

View File

@@ -50,6 +50,7 @@ There is no screenshot for this plugin
== Changelog == == Changelog ==
* Added UNIX_TIMESTAMP support
* Added DAYOFMONTH support (Thanks to Pete Deffendol for noticing the problem) * Added DAYOFMONTH support (Thanks to Pete Deffendol for noticing the problem)
* Upgrading from WP 2.8.6 to WP 2.9.1 works with a minor error * Upgrading from WP 2.8.6 to WP 2.9.1 works with a minor error
Upgrading should remove an index on table "wp_options" that may not exist, throwing an error Upgrading should remove an index on table "wp_options" that may not exist, throwing an error