summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-09-01 20:37:35 +0200
committerRobin Appelman <icewind@owncloud.com>2012-09-01 20:38:14 +0200
commit828ca2ba3624d4fb39970a84733dcbb6ab836336 (patch)
treee51db5f1ae9ee2b69333a311e2338caa033c0200 /lib
parent5a9a795cd5b69d9a6acd2b82f77c9437c362d71a (diff)
downloadnextcloud-server-828ca2ba3624d4fb39970a84733dcbb6ab836336.tar.gz
nextcloud-server-828ca2ba3624d4fb39970a84733dcbb6ab836336.zip
translate UNIX_TIMESTAMP() into sqlite and pgsql equivilents
Diffstat (limited to 'lib')
-rw-r--r--lib/db.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/db.php b/lib/db.php
index 884bbb5e905..1979b82f8cc 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -535,8 +535,12 @@ class OC_DB {
$query = str_replace( '`', '"', $query );
$query = str_replace( 'NOW()', 'datetime(\'now\')', $query );
$query = str_replace( 'now()', 'datetime(\'now\')', $query );
+ $query = str_replace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $query );
+ $query = str_replace( 'unix_timestamp()', 'strftime(\'%s\',\'now\')', $query );
}elseif( $type == 'pgsql' ){
$query = str_replace( '`', '"', $query );
+ $query = str_replace( 'UNIX_TIMESTAMP()', 'cast(extract(epoch from current_timestamp) as integer)', $query );
+ $query = str_replace( 'unix_timestamp()', 'cast(extract(epoch from current_timestamp) as integer)', $query );
}elseif( $type == 'oci' ){
$query = str_replace( '`', '"', $query );
$query = str_replace( 'NOW()', 'CURRENT_TIMESTAMP', $query );