修正quote问题

This commit is contained in:
thinkphp
2015-12-11 22:30:02 +08:00
parent 7f851362b1
commit 9ea4208579

View File

@@ -153,7 +153,7 @@ abstract class Driver
$this->queryStr = $str; $this->queryStr = $str;
if (!empty($this->bind)) { if (!empty($this->bind)) {
$that = $this; $that = $this;
$this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return '\'' . $that->escapeString($val) . '\'';}, $this->bind)); $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return $that->escapeString($val);}, $this->bind));
} }
if ($fetchSql) { if ($fetchSql) {
return $this->queryStr; return $this->queryStr;
@@ -213,7 +213,7 @@ abstract class Driver
$this->queryStr = $str; $this->queryStr = $str;
if (!empty($this->bind)) { if (!empty($this->bind)) {
$that = $this; $that = $this;
$this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return '\'' . $that->escapeString($val) . '\'';}, $this->bind)); $this->queryStr = strtr($this->queryStr, array_map(function ($val) use ($that) {return $that->escapeString($val);}, $this->bind));
} }
if ($fetchSql) { if ($fetchSql) {
return $this->queryStr; return $this->queryStr;
@@ -454,7 +454,7 @@ abstract class Driver
protected function parseValue($value) protected function parseValue($value)
{ {
if (is_string($value)) { if (is_string($value)) {
$value = strpos($value, ':') === 0 && in_array($value, array_keys($this->bind)) ? $this->escapeString($value) : '\'' . $this->escapeString($value) . '\''; $value = strpos($value, ':') === 0 && in_array($value, array_keys($this->bind)) ? $value : $this->escapeString($value);
} elseif (isset($value[0]) && is_string($value[0]) && strtolower($value[0]) == 'exp') { } elseif (isset($value[0]) && is_string($value[0]) && strtolower($value[0]) == 'exp') {
$value = $this->escapeString($value[1]); $value = $this->escapeString($value[1]);
} elseif (is_array($value)) { } elseif (is_array($value)) {