Exemplo n.º 1
0
 /**
  * Proxies this request to @see $db
  */
 function escape($s, $isIndent = false)
 {
     return $this->db->escape($s, $isIndent);
 }
Exemplo n.º 2
0
 protected function _getSqlWithArrayConditions($sql, $conditions)
 {
     $i = 0;
     foreach ($conditions as $k => $v) {
         $sql .= $i == 0 ? " WHERE" : " AND";
         if (is_array($v)) {
             $sql .= sprintf(" %s IN (%s)", $this->_db->escape($k, true), $this->_escapeJoinArray($v));
         } elseif (is_null($v)) {
             $sql .= sprintf(" %s IS NULL", $this->_db->escape($k, true));
         } else {
             $sql .= sprintf(" %s=%s", $this->_db->escape($k, true), $this->_db->escape($v));
         }
         $i++;
     }
     return $sql;
 }
Exemplo n.º 3
0
 protected function _getSqlWithArrayConditions($sql, $conditions)
 {
     $i = 0;
     foreach ($conditions as $k => $v) {
         $sql .= $i == 0 ? " WHERE" : " AND";
         if (is_array($v)) {
             $sql .= sprintf(" %s IN (%s)", $this->_db->escape($k, true), $this->_escapeJoinArray($v));
         } elseif (is_null($v)) {
             $sql .= sprintf(" %s IS NULL", $this->_db->escape($k, true));
         } elseif ($v && substr($v, 0, 2) == '<=') {
             $v = substr($v, 2);
             $sql .= sprintf(" %s<=%s", $this->_db->escape($k, true), $this->_db->escape($v));
         } elseif ($v && substr($v, 0, 2) == '>=') {
             $v = substr($v, 2);
             $sql .= sprintf(" %s>=%s", $this->_db->escape($k, true), $this->_db->escape($v));
         } elseif ($v && substr($v, 0, 2) == '<>') {
             $v = substr($v, 2);
             $sql .= sprintf(" %s<>%s", $this->_db->escape($k, true), $this->_db->escape($v));
         } elseif ($v && $v[0] == '<') {
             $v = substr($v, 1);
             $sql .= sprintf(" %s<%s", $this->_db->escape($k, true), $this->_db->escape($v));
         } elseif ($v && $v[0] == '>') {
             $v = substr($v, 1);
             $sql .= sprintf(" %s>%s", $this->_db->escape($k, true), $this->_db->escape($v));
         } else {
             $sql .= sprintf(" %s=%s", $this->_db->escape($k, true), $this->_db->escape($v));
         }
         $i++;
     }
     return $sql;
 }