Beispiel #1
0
 /**
  * 转义SQL 语句中使用的字符串中的特殊字符
  * 
  * 数组转换:仅支持单维数组
  * array('fafdas', 'fd', 'eeee', 'bbbbb')
  * ↓↓↓↓
  * 'fafdas', 'fd', 'eeee', 'bbbbb'
  * 
  * @param string|int|array $value
  * @return string
  */
 public function escape($value)
 {
     $this->setAdapter();
     if (is_array($value)) {
         $inArray = array();
         foreach ($value as $item) {
             $inArray[] = $this->adapter->getConnection()->quote($item);
         }
         return implode(',', $inArray);
     } else {
         return $this->adapter->getConnection()->quote($value);
     }
 }