/** * Return the SQL String * * @param \Parm\DataAccessObjectFactory $factory * @return string */ public function getSQL(\Parm\DataAccessObjectFactory $factory) { if ($this->value === null) { return $this->field . " " . $this->operator . " NULL"; } elseif (is_int($this->value)) { return $this->field . " " . $this->operator . " " . $this->value; } else { return $this->field . " " . $this->operator . " " . $factory->escapeString($this->value); } }
public function getSQL(\Parm\DataAccessObjectFactory $factory) { if (count($this->array) > 0) { $escaped = array(); foreach ($this->array as $key => $item) { if (is_numeric($item)) { $escaped[] = $item; } else { $escaped[] = $factory->escapeString($item); } } return $this->field . " IN (" . implode(",", $escaped) . ")"; } else { throw new \Parm\Exception\ErrorException("The array passed to the NotInBinding is empty"); } }
/** * @param $columnName * @param null $format * @return mixed|string * @throws GetFieldValueException */ protected function getDatetimeFieldValue($columnName, $format = null) { if ($format != null && $this->getFieldValue($columnName) != null) { $dateTime = \DateTime::createFromFormat($this->factory->getDatetimeStorageFormat(), $this->getFieldValue($columnName)); if ($dateTime) { // $dateTime will be a new DateTime instance or FALSE on failure. return $dateTime->format($format); } } return $this->getFieldValue($columnName); }
public function getSQL(\Parm\DataAccessObjectFactory $factory) { if ($this->value === null) { return $this->field . " " . $this->operator . " NULL"; } elseif ($this->value instanceof \DateTime) { return $this->field . " " . $this->operator . " " . $factory->escapeString($this->value->format($factory->getDateStorageFormat())); } elseif (is_numeric($this->value)) { $date = new \DateTime(); $date->setTimestamp((int) $this->value); return $this->field . " " . $this->operator . " " . $factory->escapeString($date->format($factory->getDateStorageFormat())); } else { return $this->field . " " . $this->operator . " " . $factory->escapeString((string) $this->value); } }
/** * Return the SQL String * * @param $factory DataAccessObjectFactory * @return string */ public function getSQL(DataAccessObjectFactory $factory) { return $this->field . " COLLATE " . Config::getCaseSenstitiveCollation() . " LIKE " . $factory->escapeString(str_replace("_", "\\_", str_replace("%", "\\%", $this->value))); }
/** * Return the SQL String * * @param $factory DataAccessObjectFactory * @return string */ public function getSQL(\Parm\DataAccessObjectFactory $factory) { return $this->field . " LIKE " . $factory->escapeString('%' . str_replace("_", "\\_", str_replace("%", "\\%", $this->query)) . '%') . ""; }