改进参数绑定类型对枚举类型的支持

This commit is contained in:
thinkphp
2017-10-31 12:12:49 +08:00
parent 5b15364fd2
commit 9db0007e36

View File

@@ -1818,7 +1818,9 @@ class Query
*/ */
protected function getFieldBindType($type) protected function getFieldBindType($type)
{ {
if (preg_match('/(int|double|float|decimal|real|numeric|serial|bit)/is', $type)) { if (0 === strpos($type, 'set') || 0 === strpos($type, 'enum')) {
$bind = PDO::PARAM_STR;
} elseif (preg_match('/(int|double|float|decimal|real|numeric|serial|bit)/is', $type)) {
$bind = PDO::PARAM_INT; $bind = PDO::PARAM_INT;
} elseif (preg_match('/bool/is', $type)) { } elseif (preg_match('/bool/is', $type)) {
$bind = PDO::PARAM_BOOL; $bind = PDO::PARAM_BOOL;