]> source.dussan.org Git - nextcloud-server.git/commitdiff
translate UNIX_TIMESTAMP() into sqlite and pgsql equivilents
authorRobin Appelman <icewind@owncloud.com>
Sat, 1 Sep 2012 18:37:35 +0000 (20:37 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sat, 1 Sep 2012 18:38:14 +0000 (20:38 +0200)
lib/db.php

index 884bbb5e9056f0de67f2661a7e02bd2101c1b5c2..1979b82f8cccaa7c8b5d04875ae4c21f5aed5923 100644 (file)
@@ -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 );