diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-04-28 17:40:51 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-04-28 17:40:51 +0200 |
commit | 3e99aefb7ebdb115794ec7d25b2e73db504252ff (patch) | |
tree | b55ff6d86734035378b51b990823dfdd36b79898 /lib/database.php | |
parent | 91743514120d276ab7c1f0774c441ffd174bb11d (diff) | |
download | nextcloud-server-3e99aefb7ebdb115794ec7d25b2e73db504252ff.tar.gz nextcloud-server-3e99aefb7ebdb115794ec7d25b2e73db504252ff.zip |
make logs work with sqlite
Diffstat (limited to 'lib/database.php')
-rw-r--r-- | lib/database.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/database.php b/lib/database.php index 3c2480c8b6d..728e7359040 100644 --- a/lib/database.php +++ b/lib/database.php @@ -300,7 +300,13 @@ class OC_DB { // We need Database type and table prefix $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); - + + // differences is getting the current timestamp + if( $CONFIG_DBTYPE == 'sqlite' ){ + $query = str_replace( 'NOW()', "strftime('%s', 'now')", $query ); + $query = str_replace( 'now()', "strftime('%s', 'now')", $query ); + } + // differences in escaping of table names (` for mysql) // Problem: what if there is a ` in the value we want to insert? if( $CONFIG_DBTYPE == 'sqlite' ){ @@ -310,7 +316,7 @@ class OC_DB { $query = str_replace( '`', '"', $query ); } - // replace table names + // replace table name prefix $query = str_replace( '*PREFIX*', $CONFIG_DBTABLEPREFIX, $query ); return $query; |