Skip to content

Commit 685b570

Browse files
committed
bad case: enum type use number and set default, then it has sql error.
1 parent 2d12e8d commit 685b570

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Convertor.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,11 @@ private function convert_field_data($attrs)
335335
if (isset($attrs['Default'])) {
336336
if ($attrs['Default'] != "") {
337337
//TODO: See more cases!
338-
if (is_numeric($attrs['Default']) || in_array($attrs['Default'], $this->defaultWords)) {
339-
$fieldStr .= " DEFAULT ".$attrs['Default'];
338+
if (substr($attrs['Type'], 0, 4) != "enum"
339+
&& (is_numeric($attrs['Default']) || in_array($attrs['Default'], $this->defaultWords))) {
340+
$fieldStr .= " DEFAULT " . $attrs['Default'];
340341
} else {
341-
$fieldStr .= " DEFAULT '".$attrs['Default']."'";
342+
$fieldStr .= " DEFAULT '" . $attrs['Default'] . "'";
342343
}
343344
}
344345
}

0 commit comments

Comments
 (0)