/**
  * Generates a string which is suitable for output into an sql query from
  * any data that may be outputable. This method protects strings against
  *
  * @param CDbConnection $connection
  * @param mixed $columnInsertValue
  * @return string
  */
 public function secureOutput(CDbConnection $connection, $columnInsertValue)
 {
     if ($columnInsertValue === null) {
         return 'NULL';
     }
     return $connection->quoteValue($columnInsertValue);
 }
Beispiel #2
0
 /**
  * gets the list of left and right boundaries for any given owner objects.
  *
  * @param CDbConnection $db
  * @param string        $tree_table
  * @param string        $obj_id
  *
  * @returns array of array(left, right)
  */
 protected function _treeLimits($db, $tree_table, $obj_id)
 {
     $query = 'SELECT ' . $this->leftAttribute . ',' . $this->rightAttribute . ' FROM ' . $tree_table . ' WHERE ' . $this->idAttribute . ' = ' . $db->quoteValue($obj_id);
     $res = $db->createCommand($query)->query();
     $result = array();
     foreach ($res as $r) {
         $result[] = array($r[$this->leftAttribute], $r[$this->rightAttribute]);
     }
     return $result;
 }
 public function escape($string)
 {
     $this->db->quoteValue($string);
 }