From 81138304bda0b99815f7c3d87494aa3f9e771366 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Wed, 9 Jun 2004 16:13:46 +0000 Subject: [PATCH] * fixed indexExists * wfStrencode now uses pg_escape_string instead of addslashes * timestamp functions designed to use internal PG timestamp --- includes/DatabasePostgreSQL.php | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 3633d63d96..83a07aa9fe 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -1,4 +1,5 @@ query( $sql, DB_READ, $fname ); if ( !$res ) { return NULL; @@ -504,24 +501,24 @@ function wfEmergencyAbort( &$conn ) { function wfStrencode( $s ) { - return addslashes( $s ); + return pg_escape_string( $s ); } -# Ideally we'd be using actual time fields in the db +# Use PostgreSQL timestamp without timezone data type function wfTimestamp2Unix( $ts ) { - return gmmktime( ( (int)substr( $ts, 8, 2) ), - (int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ), - (int)substr( $ts, 4, 2 ), (int)substr( $ts, 6, 2 ), - (int)substr( $ts, 0, 4 ) ); + return gmmktime( ( (int)substr( $ts, 11, 2) ), + (int)substr( $ts, 14, 2 ), (int)substr( $ts, 17, 2 ), + (int)substr( $ts, 5, 2 ), (int)substr( $ts, 8, 2 ), + (int)substr( $ts, 0, 4 ) ); } function wfUnix2Timestamp( $unixtime ) { - return gmdate( "YmdHis", $unixtime ); + return gmdate( "Y-m-d H:i:s", $unixtime ); } function wfTimestampNow() { # return NOW - return gmdate( "YmdHis" ); + return gmdate( "Y-m-d H:i:s" ); } # Sorting hack for MySQL 3, which doesn't use index sorts for DESC -- 2.20.1