[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
This commit is contained in:
Andreas Fischer 2010-05-14 02:33:31 +02:00
parent b3bbe57603
commit 032a9f58f9

View file

@ -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