Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Db / Sql / Platform / Mysql / SelectDecorator.php
blob73e8d25e4bb4ee9a9cd00f9eb11afc2e12cc2318
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Db\Sql\Platform\Mysql;
12 use Zend\Db\Adapter\AdapterInterface;
13 use Zend\Db\Adapter\Driver\DriverInterface;
14 use Zend\Db\Adapter\ParameterContainer;
15 use Zend\Db\Adapter\Platform\PlatformInterface;
16 use Zend\Db\Adapter\StatementContainerInterface;
17 use Zend\Db\Sql\Platform\PlatformDecoratorInterface;
18 use Zend\Db\Sql\Select;
20 class SelectDecorator extends Select implements PlatformDecoratorInterface
22 /**
23 * @var Select
25 protected $select = null;
27 /**
28 * @param Select $select
30 public function setSubject($select)
32 $this->select = $select;
35 /**
36 * @param AdapterInterface $adapter
37 * @param StatementContainerInterface $statementContainer
39 public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer)
41 // localize variables
42 foreach (get_object_vars($this->select) as $name => $value) {
43 $this->{$name} = $value;
45 parent::prepareStatement($adapter, $statementContainer);
48 /**
49 * @param PlatformInterface $platform
50 * @return string
52 public function getSqlString(PlatformInterface $platform = null)
54 // localize variables
55 foreach (get_object_vars($this->select) as $name => $value) {
56 $this->{$name} = $value;
58 return parent::getSqlString($platform);
61 protected function processLimit(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
63 if ($this->limit === null) {
64 return null;
66 if ($driver) {
67 $sql = $driver->formatParameterName('limit');
68 $parameterContainer->offsetSet('limit', (int) $this->limit, ParameterContainer::TYPE_INTEGER);
69 } else {
70 $sql = $this->limit;
73 return array($sql);
76 protected function processOffset(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
78 if ($this->offset === null) {
79 return null;
81 if ($driver) {
82 $parameterContainer->offsetSet('offset', (int) $this->offset, ParameterContainer::TYPE_INTEGER);
83 return array($driver->formatParameterName('offset'));
86 return array($this->offset);