torrentpier-lts/library/Zend/Db/Sql/Predicate/IsNull.php

97 lines
2.0 KiB
PHP
Raw Normal View History

<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
2023-04-01 09:03:34 +03:00
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Zend\Db\Sql\Predicate;
2023-04-01 09:03:34 +03:00
use Zend\Db\Sql\AbstractExpression;
class IsNull extends AbstractExpression implements PredicateInterface
{
/**
* @var string
*/
protected $specification = '%1$s IS NULL';
/**
* @var
*/
protected $identifier;
/**
* Constructor
*
* @param string $identifier
*/
public function __construct($identifier = null)
{
if ($identifier) {
$this->setIdentifier($identifier);
}
}
/**
* Set identifier for comparison
*
* @param string $identifier
* @return IsNull
*/
public function setIdentifier($identifier)
{
$this->identifier = $identifier;
return $this;
}
/**
* Get identifier of comparison
*
* @return null|string
*/
public function getIdentifier()
{
return $this->identifier;
}
/**
* Set specification string to use in forming SQL predicate
*
* @param string $specification
* @return IsNull
*/
public function setSpecification($specification)
{
$this->specification = $specification;
return $this;
}
/**
* Get specification string to use in forming SQL predicate
*
* @return string
*/
public function getSpecification()
{
return $this->specification;
}
/**
* Get parts for where statement
*
* @return array
*/
public function getExpressionData()
{
2023-04-01 09:03:34 +03:00
$identifier = $this->normalizeArgument($this->identifier, self::TYPE_IDENTIFIER);
return array(array(
$this->getSpecification(),
2023-04-01 09:03:34 +03:00
array($identifier[0]),
array($identifier[1]),
));
}
}