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);
     }
 }
 /**
  * Delete the object from the database.
  * @return TRUE if successful, False if failed or ID is not greater than
  *
  * @throws Exception\RecordNotFoundException
  * @throws Exception\UpdateFailedException
  */
 public function delete()
 {
     if (!$this->isNewObject()) {
         $this->factory->update("DELETE FROM " . $this->getTableName() . " WHERE " . $this->getIdField() . " = " . $this->factory->escapeString($this->getId()));
     } else {
         throw new RecordNotFoundException("delete() failed: You can't delete this object from the database as it hasn't been saved yet.");
     }
 }
 /**
  * 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");
     }
 }
 /**
  * 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)) . '%') . "";
 }