public function query($sql, $bind = [], $master = false, $class = false)
{
$this->initConnect($master);
if (!$this->li
return false;
}
// 根据参数绑定组装最终的SQL语句
$this->queryStr = $this->getRealSql($sql, $bind);
//释放前次的查询结果
if (!empty($this->PDOStatement)) {
$this->free();
}
}
public function getRealSql($sql, array $bind = [])
{
if ($bind) {
foreach ($bind as $key => $val) {
$value = is_array($val) ? $val[0] : $val;
$type = is_array($val) ? $val[1] : PDO::PARAM_STR;
if (PDO::PARAM_STR == $type) {
$value = $this->quote($value);
} elseif (PDO::PARAM_INT == $type && '' === $value) {
$value = 0;
}
}}
public function quote($str, $master = true)
{
$this->initConnect($master);
return $this->li
}
最佳答案