From 58f09c40f8e31e6fe585d939272cc94bb9db6d47 Mon Sep 17 00:00:00 2001 From: zYne Date: Mon, 21 Aug 2006 23:15:17 +0000 Subject: [PATCH] --- Doctrine/Session/Common.php | 25 ------ Doctrine/Session/Exception.php | 13 --- Doctrine/Session/Firebird.php | 20 ----- Doctrine/Session/Informix.php | 6 -- Doctrine/Session/Mssql.php | 72 --------------- Doctrine/Session/Mysql.php | 159 --------------------------------- Doctrine/Session/Oracle.php | 32 ------- Doctrine/Session/Pgsql.php | 18 ---- Doctrine/Session/Sqlite.php | 7 -- 9 files changed, 352 deletions(-) delete mode 100644 Doctrine/Session/Common.php delete mode 100644 Doctrine/Session/Exception.php delete mode 100644 Doctrine/Session/Firebird.php delete mode 100644 Doctrine/Session/Informix.php delete mode 100644 Doctrine/Session/Mssql.php delete mode 100644 Doctrine/Session/Mysql.php delete mode 100644 Doctrine/Session/Oracle.php delete mode 100644 Doctrine/Session/Pgsql.php delete mode 100644 Doctrine/Session/Sqlite.php diff --git a/Doctrine/Session/Common.php b/Doctrine/Session/Common.php deleted file mode 100644 index 070e51b5c..000000000 --- a/Doctrine/Session/Common.php +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/Doctrine/Session/Exception.php b/Doctrine/Session/Exception.php deleted file mode 100644 index 3d7c2fdb0..000000000 --- a/Doctrine/Session/Exception.php +++ /dev/null @@ -1,13 +0,0 @@ -openSession() to open a new session.",Doctrine::ERR_NO_SESSIONS); - } -} -?> diff --git a/Doctrine/Session/Firebird.php b/Doctrine/Session/Firebird.php deleted file mode 100644 index 709dd3e7d..000000000 --- a/Doctrine/Session/Firebird.php +++ /dev/null @@ -1,20 +0,0 @@ -query("SELECT UNIQUE FROM ".$sequence); - $data = $stmt->fetch(PDO::FETCH_NUM); - return $data[0]; - } -} -?> diff --git a/Doctrine/Session/Informix.php b/Doctrine/Session/Informix.php deleted file mode 100644 index 5465f89df..000000000 --- a/Doctrine/Session/Informix.php +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/Doctrine/Session/Mssql.php b/Doctrine/Session/Mssql.php deleted file mode 100644 index 4c0c71cf0..000000000 --- a/Doctrine/Session/Mssql.php +++ /dev/null @@ -1,72 +0,0 @@ -query("INSERT INTO $sequence (vapor) VALUES (0)"); - $stmt = $this->query("SELECT @@IDENTITY FROM $sequence"); - $data = $stmt->fetch(PDO::FETCH_NUM); - return $data[0]; - } - /** - * Adds an adapter-specific LIMIT clause to the SELECT statement. - * [ borrowed from Zend Framework ] - * - * @param string $query - * @param mixed $limit - * @param mixed $offset - * @link http://lists.bestpractical.com/pipermail/rt-devel/2005-June/007339.html - * @return string - */ - public function modifyLimitQuery($query, $limit, $offset) { - if ($limit) { - - // we need the starting SELECT clause for later - $select = 'SELECT '; - if (preg_match('/^[[:space:]*SELECT[[:space:]]*DISTINCT/i', $query, $matches) == 1) - $select .= 'DISTINCT '; - - $length = strlen($select); - - // is there an offset? - if (! $offset) { - // no offset, it's a simple TOP count - return "$select TOP $count" . substr($query, $length); - } - - // the total of the count **and** the offset, combined. - // this will be used in the "internal" portion of the - // hacked-up statement. - $total = $count + $offset; - - // build the "real" order for the external portion. - $order = implode(',', $parts['order']); - - // build a "reverse" order for the internal portion. - $reverse = $order; - $reverse = str_ireplace(" ASC", " \xFF", $reverse); - $reverse = str_ireplace(" DESC", " ASC", $reverse); - $reverse = str_ireplace(" \xFF", " DESC", $reverse); - - // create a main statement that replaces the SELECT - // with a SELECT TOP - $main = "\n$select TOP $total" . substr($query, $length) . "\n"; - - // build the hacked-up statement. - // do we really need the "as" aliases here? - $query = "SELECT * FROM (" - . "SELECT TOP $count * FROM ($main) AS select_limit_rev ORDER BY $reverse" - . ") AS select_limit ORDER BY $order"; - - } - - return $query; - } -} -?> diff --git a/Doctrine/Session/Mysql.php b/Doctrine/Session/Mysql.php deleted file mode 100644 index 4ca2457e0..000000000 --- a/Doctrine/Session/Mysql.php +++ /dev/null @@ -1,159 +0,0 @@ -setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - parent::__construct($manager,$pdo); - } - /** - * deletes all data access object from the collection - * @param Doctrine_Collection $coll - */ - /** - public function deleteCollection(Doctrine_Collection $coll) { - - $a = $coll->getTable()->getCompositePaths(); - $a = array_merge(array($coll->getTable()->getComponentName()),$a); - - $graph = new Doctrine_DQL_Parser($this); - foreach($coll as $k=>$record) { - switch($record->getState()): - case Doctrine_Record::STATE_DIRTY: - case Doctrine_Record::STATE_CLEAN: - $ids[] = $record->getID(); - break; - endswitch; - } - if(empty($ids)) - return array(); - - $graph->parseQuery("FROM ".implode(", ",$a)." WHERE ".$coll->getTable()->getTableName().".id IN(".implode(", ",$ids).")"); - - $query = $graph->buildDelete(); - - $this->getDBH()->query($query); - return $ids; - } - */ - - /** - * returns maximum identifier values - * - * @param array $names an array of component names - * @return array - */ - public function getMaximumValues2(array $names) { - $values = array(); - foreach($names as $name) { - $table = $this->tables[$name]; - $keys = $table->getPrimaryKeys(); - $tablename = $table->getTableName(); - - if(count($keys) == 1 && $keys[0] == $table->getIdentifier()) { - // record uses auto_increment column - - $sql[] = "SELECT MAX(".$tablename.".".$table->getIdentifier().") as $tablename FROM ".$tablename; - $values[$tablename] = 0; - $array[] = $tablename; - } - } - $sql = implode(" UNION ",$sql); - $stmt = $this->getDBH()->query($sql); - $data = $stmt->fetchAll(PDO::FETCH_NUM); - - foreach($data as $k => $v) { - $values[$array[$k]] = $v[0]; - } - return $values; - } - /** - * bulkInsert - * inserts all the objects in the pending insert list into database - * TODO: THIS IS NOT WORKING YET AS THERE ARE BUGS IN COMPONENTS USING SELF-REFERENCENCING - * - * @return boolean - */ - - /** - public function bulkInsert() { - if(empty($this->insert)) - return false; - - foreach($this->insert as $name => $inserts) { - if( ! isset($inserts[0])) - continue; - - $record = $inserts[0]; - $table = $record->getTable(); - $seq = $table->getSequenceName(); - $keys = $table->getPrimaryKeys(); - - $marks = array(); - $params = array(); - foreach($inserts as $k => $record) { - $record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onPreSave($record); - // listen the onPreInsert event - $record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onPreInsert($record); - - $array = $record->getPrepared(); - - if(isset($this->validator)) { - if( ! $this->validator->validateRecord($record)) { - continue; - } - } - - $key = implode(", ",array_keys($array)); - if( ! isset($params[$key])) - $params[$key] = array(); - - $marks[$key][] = "(".substr(str_repeat("?, ",count($array)),0,-2).")"; - $params[$key] = array_merge($params[$key], array_values($array)); - - - // listen the onInsert event - $record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onInsert($record); - - $record->getTable()->getAttribute(Doctrine::ATTR_LISTENER)->onSave($record); - } - - if( ! empty($marks)) { - foreach($marks as $key => $list) { - $query = "INSERT INTO ".$table->getTableName()." (".$key.") VALUES ".implode(", ", $list); - $stmt = $this->getDBH()->prepare($query); - $stmt->execute($params[$key]); - } - } - if(count($keys) == 1 && $keys[0] == $table->getIdentifier()) { - - // record uses auto_increment column - - $sql = "SELECT MAX(".$table->getIdentifier().") FROM ".$record->getTable()->getTableName(); - $stmt = $this->getDBH()->query($sql); - $data = $stmt->fetch(PDO::FETCH_NUM); - $id = $data[0]; - $stmt->closeCursor(); - - foreach(array_reverse($inserts) as $record) { - - $record->setID((int) $id); - $id--; - } - } - } - - $this->insert = array(); - return true; - } - */ - -} -?> diff --git a/Doctrine/Session/Oracle.php b/Doctrine/Session/Oracle.php deleted file mode 100644 index b265225ab..000000000 --- a/Doctrine/Session/Oracle.php +++ /dev/null @@ -1,32 +0,0 @@ -= ".++$offset; - return $query; - } - /** - * returns the next value in the given sequence - * @param string $sequence - * @return integer - */ - public function getNextID($sequence) { - $stmt = $this->query("SELECT $sequence.nextval FROM dual"); - $data = $stmt->fetch(PDO::FETCH_NUM); - return $data[0]; - } -} -?> diff --git a/Doctrine/Session/Pgsql.php b/Doctrine/Session/Pgsql.php deleted file mode 100644 index f4a069b30..000000000 --- a/Doctrine/Session/Pgsql.php +++ /dev/null @@ -1,18 +0,0 @@ -query("SELECT NEXTVAL('$sequence')"); - $data = $stmt->fetch(PDO::FETCH_NUM); - return $data[0]; - } -} -?> diff --git a/Doctrine/Session/Sqlite.php b/Doctrine/Session/Sqlite.php deleted file mode 100644 index fa7e42309..000000000 --- a/Doctrine/Session/Sqlite.php +++ /dev/null @@ -1,7 +0,0 @@ -