const PARAM_NULL = 0;
const PARAM_STMT = 4;
const PARAM_STR = 2;
-}
\ No newline at end of file
+}
public function __construct(IPF_ORM_Manager $manager, $adapter, $user = null, $pass = null)
{
if (is_object($adapter)) {
- if ( ! ($adapter instanceof PDO) && ! in_array('IPF_ORM_Adapter_Interface', class_implements($adapter))) {
- throw new IPF_ORM_Exception('First argument should be an instance of PDO or implement IPF_ORM_Adapter_Interface');
+ if (!($adapter instanceof PDO)) {
+ throw new IPF_ORM_Exception('First argument should be an instance of PDO');
}
$this->dbh = $adapter;
-
$this->isConnected = true;
-
} else if (is_array($adapter)) {
$this->pendingAttributes[IPF_ORM::ATTR_DRIVER_NAME] = $adapter['scheme'];
public function getQueryRegistry()
{
- if ( ! isset($this->_queryRegistry)) {
- $this->_queryRegistry = new IPF_ORM_Query_Registry;
- }
+ if ( ! isset($this->_queryRegistry)) {
+ $this->_queryRegistry = new IPF_ORM_Query_Registry;
+ }
return $this->_queryRegistry;
}
return $this;
}
- public static function connection($adapter = null, $name = null)
+ public static function connection()
{
- if ($adapter == null) {
- return IPF_ORM_Manager::getInstance()->getCurrentConnection();
- } else {
- return IPF_ORM_Manager::getInstance()->openConnection($adapter, $name);
- }
+ return IPF_ORM_Manager::getInstance()->getCurrentConnection();
}
public function openConnection($adapter, $name = null, $setCurrent = true, $persistent = false)
{
if (is_object($adapter)) {
- if ( ! ($adapter instanceof PDO) && ! in_array('IPF_ORM_Adapter_Interface', class_implements($adapter))) {
- throw new IPF_ORM_Exception("First argument should be an instance of PDO or implement IPF_ORM_Adapter_Interface");
- }
-
- $driverName = $adapter->getAttribute(IPF_ORM::ATTR_DRIVER_NAME);
+ if (!($adapter instanceof PDO))
+ throw new IPF_ORM_Exception("First argument should be an instance of PDO");
+ $driverName = $adapter->getAttribute(PDO::ATTR_DRIVER_NAME);
} else if (is_array($adapter)) {
if ( ! isset($adapter[0])) {
throw new IPF_ORM_Exception('Empty data source name given.');
+++ /dev/null
-<?php
-
-interface IPF_ORM_Overloadable {
- public function __call($m, $a);
-}
\ No newline at end of file
$this->_expressionMap = array();
$this->_subqueryAliases = array();
$this->_needsSubquery = false;
- $this->_isLimitSubqueryUsed = false;
}
public function createSubquery()
if ( ! empty($this->_sqlParts['limit']) && $this->_needsSubquery &&
$table->getAttribute(IPF_ORM::ATTR_QUERY_LIMIT) == IPF_ORM::LIMIT_RECORDS) {
- $this->_isLimitSubqueryUsed = true;
$needsSubQuery = true;
}
);
protected $_enumParams = array();
- protected $_isLimitSubqueryUsed = false;
protected $_pendingSetParams = array();
protected $_components;
protected $_preQueried = false;
return $this->_view;
}
- public function isLimitSubqueryUsed()
- {
- return $this->_isLimitSubqueryUsed;
- }
-
public function convertEnums($params)
{
$table = $this->getRoot();
$query = $this->_view->getSelectSql();
}
- if ($this->isLimitSubqueryUsed() &&
- $this->_conn->getAttribute(IPF_ORM::ATTR_DRIVER_NAME) !== 'mysql') {
- $params = array_merge($params, $params);
- }
-
if ($this->_type !== self::SELECT) {
return $this->_conn->exec($query, $params);
}