postgres fix (error in converting varchar to int if >= 100)

This commit is contained in:
Ralf Becker 2004-11-21 22:40:21 +00:00
parent 920af8e10e
commit 3b2da86ce2
2 changed files with 2 additions and 2 deletions

View File

@ -214,7 +214,7 @@ class ADODB2_postgres extends ADODB_DataDict {
// we need to explicit convert varchar to a number to be able to do an AlterColumn of a char column to a nummeric one // we need to explicit convert varchar to a number to be able to do an AlterColumn of a char column to a nummeric one
if (preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches) && if (preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches) &&
in_array($fld->type,array('varchar','char','text','bytea'))) { in_array($fld->type,array('varchar','char','text','bytea'))) {
$copyflds[] = "to_number($fld->name,'S99D99')"; $copyflds[] = "to_number($fld->name,'S9999999999999D99')";
} else { } else {
$copyflds[] = $fld->name; $copyflds[] = $fld->name;
} }

View File

@ -438,7 +438,7 @@
in_array($old_table_def['fd'][$name]['type'],array('char','varchar','text','blob')) && in_array($old_table_def['fd'][$name]['type'],array('char','varchar','text','blob')) &&
in_array($data['type'],array('int','decimal'))) in_array($data['type'],array('int','decimal')))
{ {
$value = "to_number($name,'S99D99')"; $value = "to_number($name,'S9999999999999D99')";
} }
} }
else // new column => use default value or NULL else // new column => use default value or NULL