From c2f5a06ae693b5075749e81e4e4fad073a2fc505 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 6 Jun 2015 20:29:58 -0600 Subject: [PATCH] [nextgen-gallery] Support SIGNED data type in CAST() MySQL recognizes SIGNED and UNSIGNED in place of SIGNED INTEGER and UNSIGNED INTEGER. Notice this in calls to CAST() and replace it with INTEGER (which is signed by default). Signed-off-by: Kevin Locke --- pg4wp/driver_pgsql.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pg4wp/driver_pgsql.php b/pg4wp/driver_pgsql.php index 4a5702d..46ba043 100644 --- a/pg4wp/driver_pgsql.php +++ b/pg4wp/driver_pgsql.php @@ -233,6 +233,9 @@ // Handle CAST( ... AS CHAR) $sql = preg_replace( '/CAST\((.+) AS CHAR\)/', 'CAST($1 AS TEXT)', $sql); + + // Handle CAST( ... AS SIGNED) + $sql = preg_replace( '/CAST\((.+) AS SIGNED\)/', 'CAST($1 AS INTEGER)', $sql); // Handle COUNT(*)...ORDER BY... $sql = preg_replace( '/COUNT(.+)ORDER BY.+/s', 'COUNT$1', $sql);