public function testformatSqlValue() { $field = new MormFieldSqlFunction('MYSQLFUCNTION()'); $this->assertEqual('MYSQLFUCNTION()', SqlTools::formatSqlValue($field)); }
/** * createIdentifyingWhereSql * * build the sql where statement used to get the model's corresponding row or * the given key's one and return it * * @param mixed $not_yet_loaded_key * @return string */ private function createIdentifyingWhereSql($not_yet_loaded_key = null) { $pkey = is_null($not_yet_loaded_key) ? $this->getPkeyVal() : $not_yet_loaded_key; if (is_array($this->_pkey)) { $req = array(); foreach ($this->_pkey as $key) { $req[] = '`' . $this->_table . '`.`' . $key . '` = ' . SqlTools::formatSqlValue($pkey[$key]); } $where = " where " . implode(' AND ', $req); } else { $where = ' where `' . $this->_table . '`.`' . $this->_pkey . "`=" . SqlTools::formatSqlValue($pkey); } return $where; }
static function set($values) { $set = array(); foreach ($values as $field => $value) { $set[] = '`' . $field . '`=' . SqlTools::formatSqlValue($value); } return 'set ' . implode(' , ', $set); }