]> source.dussan.org Git - nextcloud-server.git/commitdiff
use str_ireplace instead of duplicate str_replace
authorRobin Appelman <icewind@owncloud.com>
Sun, 2 Sep 2012 11:58:01 +0000 (13:58 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sun, 2 Sep 2012 11:58:01 +0000 (13:58 +0200)
lib/db.php

index 1979b82f8cccaa7c8b5d04875ae4c21f5aed5923..16b39208735651d86a92facfe17c3074f2564d83 100644 (file)
@@ -533,18 +533,14 @@ class OC_DB {
                // differences in escaping of table names ('`' for mysql) and getting the current timestamp
                if( $type == 'sqlite' || $type == 'sqlite3' ){
                        $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 );
+                       $query = str_ireplace( 'NOW()', 'datetime(\'now\')', $query );
+                       $query = str_ireplace( '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 );
+                       $query = str_ireplace( '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 );
-                       $query = str_replace( 'now()', 'CURRENT_TIMESTAMP', $query );
+                       $query = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $query );
                }
 
                // replace table name prefix