From 7161a0825255fb41de96b8c0368a630018fac2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Mon, 27 Aug 2001 23:26:09 +0000 Subject: [PATCH] tried to fix some "NULL" value problems --- ChangeLog | 9 ++++++--- tbl_addfield.php3 | 5 ++++- tbl_alter.php3 | 6 +++++- tbl_properties.inc.php3 | 7 +++++++ tbl_properties.php3 | 9 ++++++++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad9951637..e3dda8ccf 100755 --- a/ChangeLog +++ b/ChangeLog @@ -6,8 +6,8 @@ $Id$ $Source$ 2001-08-27 Olivier Müller - * tbl_replace.php3: fixed the fact that the function were - ignored if the data remained unchanged. + * tbl_replace.php3: fixed the fact that the function were ignored if the + data remained unchanged. 2001-08-27 Loïc Chapeaux * lib.inc.php3: fixed some coding style inconcistencies. @@ -20,13 +20,16 @@ $Source$ * lang/romanian.inc.php3: put all the string to translate at the end and added a missing one. * lang/dutch.inc.php3: sorted the strings. + * tbl_addfield.php3, lines 32-41; tbl_alter.php3, lines 48-54; + tbl_properties.php3, lines 222-228; tbl_properties.inc.php3, + lines 152-158: tried to fix the "NULL" value problem. 2001-08-27 Marc Delisle * lang/dutch.inc.php3 updates, thanks to Arjen Roodselaar. * tbl_copy.php3, eregi_replace instead of ereg_replace because MySQL 3.23.20 returns sql keywords in lowercase, thanks to Jan Paul Schmidt. - * lang/romanian.inc.php3, select_lang.inc.php3: new romanian lang + * lang/romanian.inc.php3, select_lang.inc.php3: new romanian lang thanks to thanks to Valics Lehel (lvalics@users.sourceforge.net). 2001-08-25 Marc Delisle diff --git a/tbl_addfield.php3 b/tbl_addfield.php3 index ba5c4fbba..54db5c889 100755 --- a/tbl_addfield.php3 +++ b/tbl_addfield.php3 @@ -30,7 +30,10 @@ if (isset($submit)) { $query .= ' ' . $field_attribute[$i]; } if ($field_default[$i] != '') { - if (get_magic_quotes_gpc()) { + if (strtoupper($field_default[$i]) == 'NULL') { + $query .= ' DEFAULT NULL'; + } + else if (get_magic_quotes_gpc()) { $query .= ' DEFAULT \'' . sql_addslashes(stripslashes($field_default[$i])) . '\''; } else { $query .= ' DEFAULT \'' . sql_addslashes($field_default[$i]) . '\''; diff --git a/tbl_alter.php3 b/tbl_alter.php3 index 06471a646..f1f9c3114 100755 --- a/tbl_alter.php3 +++ b/tbl_alter.php3 @@ -46,7 +46,11 @@ if (isset($submit)) { $query .= ' ' . $field_attribute[0]; } if ($field_default[0] != '') { - $query .= ' DEFAULT \'' . sql_addslashes($field_default[0]) . '\''; + if (strtoupper($field_default[0]) == 'NULL') { + $query .= ' DEFAULT NULL'; + } else { + $query .= ' DEFAULT \'' . sql_addslashes($field_default[0]) . '\''; + } } if ($field_null[0] != '') { $query .= ' ' . $field_null[0]; diff --git a/tbl_properties.inc.php3 b/tbl_properties.inc.php3 index 376859bc4..ec5dc4854 100755 --- a/tbl_properties.inc.php3 +++ b/tbl_properties.inc.php3 @@ -149,6 +149,13 @@ for ($i = 0 ; $i < $num_fields; $i++) { ?> + " /> diff --git a/tbl_properties.php3 b/tbl_properties.php3 index 625a324c7..8b3e38ba9 100755 --- a/tbl_properties.php3 +++ b/tbl_properties.php3 @@ -219,6 +219,13 @@ while ($row = mysql_fetch_array($result)) { if ($zerofill) { $strAttribute = 'UNSIGNED ZEROFILL'; } + if (!isset($row['Default'])) { + if ($row['Null'] != '') { + $row['Default'] = 'NULL'; + } + } else { + $row['Default'] = htmlspecialchars($row['Default']); + } echo "\n"; ?> @@ -226,7 +233,7 @@ while ($row = mysql_fetch_array($result)) { >   -   +