From 3998010b324a99969fd1f7c2b74807aad4076952 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 3 Aug 2007 18:30:16 +0000 Subject: [PATCH] Don't quote certain MySQL values --- tools/create_schema.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/create_schema.php b/tools/create_schema.php index 224b02e..6bbf8f2 100644 --- a/tools/create_schema.php +++ b/tools/create_schema.php @@ -133,7 +133,16 @@ else } } - $list[] = "\t$t$field[Field]$t " . $field['Type'] . " " . ($field['Null'] == 'YES' ? "NULL" : "NOT NULL") . ($field['Extra'] != '' ? " " . strtoupper($field['Extra']) : "") . (!empty($field['default']) ? " DEFAULT '$field[Default]'" : ""); + // quote default values where appropriate + if (!empty($field['Default'])) + { + if ($field['Default'] != 'CURRENT_TIMESTAMP') + { + $field['Default'] = "'$field[Default]'"; + } + } + + $list[] = "\t$t$field[Field]$t " . $field['Type'] . " " . ($field['Null'] == 'YES' ? "NULL" : "NOT NULL") . ($field['Extra'] != '' ? " " . strtoupper($field['Extra']) : "") . (!empty($field['Default']) ? " DEFAULT $field[Default]" : ""); } $build .= implode(",\n", $list); -- 2.43.5