diff options
Diffstat (limited to 'libraries/adodb/adodb-datadict.inc.php')
-rw-r--r-- | libraries/adodb/adodb-datadict.inc.php | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/libraries/adodb/adodb-datadict.inc.php b/libraries/adodb/adodb-datadict.inc.php index 19500ca9..69060c5c 100644 --- a/libraries/adodb/adodb-datadict.inc.php +++ b/libraries/adodb/adodb-datadict.inc.php @@ -1,7 +1,7 @@ <?php /** - V5.10 10 Nov 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved. + V5.11 5 May 2010 (c) 2000-2010 John Lim (jlim#natsoft.com). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -589,6 +589,8 @@ class ADODB_DataDict { return $sql; } + + function _GenFields($flds,$widespacing=false) { @@ -913,6 +915,21 @@ class ADODB_DataDict { return $newopts; } + + function _getSizePrec($size) + { + $fsize = false; + $fprec = false; + $dotat = strpos($size,'.'); + if ($dotat === false) $dotat = strpos($size,','); + if ($dotat === false) $fsize = $size; + else { + $fsize = substr($size,0,$dotat); + $fprec = substr($size,$dotat+1); + } + return array($fsize, $fprec); + } + /** "Florian Buzin [ easywe ]" <florian.buzin#easywe.de> @@ -958,9 +975,16 @@ class ADODB_DataDict { $c = $cols[$k]; $ml = $c->max_length; $mt = $this->MetaType($c->type,$ml); + + if (isset($c->scale)) $sc = $c->scale; + else $sc = 99; // always force change if scale not known. + + if ($sc == -1) $sc = false; + list($fsize, $fprec) = $this->_getSizePrec($v['SIZE']); + if ($ml == -1) $ml = ''; if ($mt == 'X') $ml = $v['SIZE']; - if (($mt != $v['TYPE']) || $ml != $v['SIZE'] || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) { + if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) { $holdflds[$k] = $v; } } else { |