From 032a9f58f9ce4dd9777f30a8856fb49e340df179 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 May 2010 02:33:31 +0200 Subject: [PATCH] [ticket/9173] No longer limit scope of numbers we store in the config table on PostgreSQL and Firebird when using set_config_count(). Since we're using a VARCHAR(255) column to store the numbers we have to CAST the varchar string to a type we can do maths on. Using int4 or integer as the type however limits the scope to 4-byte-integer = 32-bit. Using DECIMAL(255, 0) allows the 'full' scope of decimals in varchar(255). PHPBB3-9173 --- phpBB/includes/functions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4f52c7c2ce..026496bfb3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -175,11 +175,8 @@ function set_config_count($config_name, $increment, $is_dynamic = false) switch ($db->sql_layer) { case 'firebird': - $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as VARCHAR(255))'; - break; - case 'postgres': - $sql_update = 'int4(config_value) + ' . (int) $increment; + $sql_update = 'CAST(CAST(config_value as DECIMAL(255, 0)) + ' . (int) $increment . ' as VARCHAR(255))'; break; // MySQL, SQlite, mssql, mssql_odbc, oracle