From 68d0668328a21e9a5993330fd39eb1c4633c2dbe Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 29 Nov 2005 07:52:18 +0000 Subject: [PATCH] fix for bool columns: - work around some "magic" in ADODB's datadict - MySQL4.1 allows the standard true/false for inserts only and not as default value --- phpgwapi/inc/class.egw_db.inc.php | 2 +- phpgwapi/inc/class.schema_proc.inc.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index a769cbf0fc..4c702b3429 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -1085,7 +1085,7 @@ case 'auto': return (int) $value; case 'bool': - if ($this->Type == 'mysql' && $this->ServerInfo['version'] < 4.1) + if ($this->Type == 'mysql') // maybe it's not longer necessary with mysql5 { return $value ? 1 : 0; } diff --git a/phpgwapi/inc/class.schema_proc.inc.php b/phpgwapi/inc/class.schema_proc.inc.php index bd44eed0b8..55e3f1c429 100644 --- a/phpgwapi/inc/class.schema_proc.inc.php +++ b/phpgwapi/inc/class.schema_proc.inc.php @@ -961,7 +961,8 @@ } if (isset($col_data['default'])) { - $ado_col .= ' DEFAULT '.$this->m_odb->quote($col_data['default'],$col_data['type']); + $ado_col .= (in_array($col_data['type'],array('bool','int','decimal','float','double')) && $col_data['default'] != 'NULL' ? ' NOQUOTE' : ''). + ' DEFAULT '.$this->m_odb->quote($col_data['default'],$col_data['type']); } if (in_array($col,$aTableDef['pk'])) {