Revision: 415
Author: coretxt
Date: Sun May 23 12:12:02 2010
Log: renaming mangletronic
http://code.google.com/p/floe/source/detail?r=415
Added:
/trunk/src/repository/services/mysql/MysqlAdaptor.class.php
Deleted:
/trunk/src/repository/services/mysql/MysqlGateway.class.php
Modified:
/trunk/src/repository/Storage.class.php
=======================================
--- /dev/null
+++ /trunk/src/repository/services/mysql/MysqlAdaptor.class.php Sun May 23
12:12:02 2010
@@ -0,0 +1,367 @@
+<?php
+/**
+ * This file is part of Floe, a graceful PHP framework.
+ * Copyright (C) 2005-2010 Mark Rickerby <
http://maetl.net>
+ *
+ * See the LICENSE file distributed with this software for full copyright,
disclaimer
+ * of liability, and the specific limitations that govern the use of this
software.
+ *
+ * $Id$
+ * @package repository
+ * @subpackage store.mysql
+ */
+
+require_once 'MysqlIterator.class.php';
+
+/**
+ * Gateway for managing common database operations.
+ *
+ * @package repository
+ * @subpackage store.mysql
+ */
+class MysqlGateway {
+
+ var $_connection;
+ var $_result;
+ var $_currentTable;
+
+ function __construct($connection) {
+ $this->_connection = $connection;
+ }
+
+ function affectedRows() {
+ return mysql_affected_rows($this->_result);
+ }
+
+ /**
+ * Returns the last insert id.
+ */
+ function insertId() {
+ return mysql_insert_id();
+ }
+
+ /**
+ * Returns a Record as the result of a select query.
+ *
+ * @return stdClass
+ */
+ function getObject() {
+ return mysql_fetch_object($this->_result);
+ }
+
+ /**
+ * Returns a single value from the select query result.
+ *
+ * @return mixed value
+ */
+ function getValue() {
+ $result = mysql_fetch_array($this->_result);
+ return $result[0];
+ }
+
+ /**
+ * Returns an array of objects as the result of a select query.
+ *
+ * @return array<stdClass>
+ */
+ function getObjects() {
+ $i=0; $objects = array();
+ while ($row = mysql_fetch_object($this->_result)) {
+ $objects[$i] = $row; $i++;
+ }
+ return $objects;
+ }
+
+ /**
+ * Returns an iterator for traversing the result of a select query.
+ *
+ * @return Iterator<stdClass>
+ */
+ function getIterator() {
+ return new MysqlIterator($this->_result);
+ }
+
+ /**
+ *
+ */
+ function selectById($table, $id, $target=false) {
+ $this->_currentTable = $table;
+ $fields = (!$target) ? '*' : implode(',', array_keys($target));
+ $sql = 'SELECT '.$fields.' FROM `'.$table.'` WHERE id="'.$id.'"';
+ $this->_result = $this->_connection->execute($sql);
+ }
+
+ /**
+ *
+ */
+ function selectAll($table) {
+ $this->_currentTable = $table;
+ $sql = 'SELECT * FROM `'.$table.'`';
+ $this->_result = $this->_connection->execute($sql);
+ }
+
+ /**
+ *
+ */
+ function selectByKey($table, $target) {
+ $this->_connection->connect();
+ $this->_currentTable = $table;
+ $sql = 'SELECT * FROM `'.$table.'` WHERE ';
+ $where = '';
+ foreach ($target as $key => $value) {
+ if($where != "") {
+ $where .= "AND ";
+ }
+ $where .= mysql_real_escape_string($key) .'="'.
mysql_real_escape_string($value) .'" ';
+ }
+ $sql .= $where;
+ $this->_result = $this->_connection->execute($sql);
+ }
+
+ /**
+ *
+ */
+ function selectByAssociation($table, $join_table, $target=false) {
+ $this->_currentTable = $table;
+ $sql = "SELECT * FROM `$table`,`$join_table` ";
+ $sql .= "WHERE
$
table.id=$join_table.".Inflect::toSingular($table)."_id";
+ if ($target) $sql .= " AND
$join_table.".key($target)."='".current($target)."'";
+ $this->_result = $this->_connection->execute($sql);
+ }
+
+ /**
+ * Inserts a row into specified table.
+ *
+ * @param $table string name of the table to insert into
+ * @param $columns associative array of column=>value pairs to create
+ */
+ function insert($table, $columns) {
+ $this->_connection->connect();
+ $this->_currentTable = $table;
+ $keys = array_keys($columns);
+ $values = array_values($columns);
+ $colnum = count($columns);
+ $sql = 'INSERT INTO `'.mysql_real_escape_string($table).'` (';
+ for($i=0;$i<$colnum;$i++) {
+ $sql .= Inflect::propertyToColumn($keys[$i]);
+ $i==($colnum-1) ? $sql .= ')' : $sql .= ',';
+ }
+ $sql .= ' VALUES (';
+ for($i=0;$i<$colnum;$i++) {
+ $sql .= '"'.mysql_real_escape_string((string)$values[$i]).'"';
+ $i==($colnum-1) ? $sql .= ')' : $sql .= ',';
+ }
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Creates a new row in specified table. Synonym for insert.
+ */
+ function create($table, $columns) {
+ $this->insert($table, $columns);
+ }
+
+ /**
+ * Updates a row in specified table
+ */
+ function update($table, $target, $columns) {
+ $this->_connection->connect();
+ $colnum = count($columns);
+ $i = 1;
+ $sql = 'UPDATE `'.mysql_real_escape_string($table).'` SET ';
+ foreach($columns as $field=>$val) {
+ $sql .= $field.'="'.mysql_real_escape_string($val).'"';
+ $i==$colnum ? $sql .= ' ' : $sql .= ',';
+ $i++;
+ }
+
$sql .= 'WHERE '.mysql_real_escape_string(key($target)).'="'.mysql_real_escape_string(current($target)).'"';
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Deletes row(s) specified by column=>value pair
+ *
+ */
+ function delete($table, $target) {
+ if (!is_array($target)) return;
+ $sql = 'DELETE FROM `'.$table.'` WHERE ';
+ $where = '';
+ foreach ($target as $key => $value) {
+ if($where != "") {
+ $where .= "AND ";
+ }
+ $where .= mysql_real_escape_string($key) .'="'.
mysql_real_escape_string($value) .'" ';
+ }
+ $this->_connection->execute($sql . $where);
+ }
+
+ /**
+ * Executes an arbitrary SQL query on the connection.
+ */
+ function query($sql) {
+ $this->_result = $this->_connection->execute($sql);
+ }
+
+ /**
+ * Executes an arbitrary SELECT query on the connection.
+ */
+ function select($table, $clauses) {
+ $this->_currentTable = $table;
+ $sql = "SELECT * FROM `$table` $clauses";
+ $this->_result = $this->_connection->execute($sql);
+ }
+
+ /**
+ * Creates a table with specified columns
+ */
+ function createTable($table, $rows, $type='MyISAM') {
+ $sql = "\nCREATE TABLE `$table` (";
+ $sql .= "\nid int(11) NOT NULL auto_increment,";
+ foreach($rows as $key=>$val) {
+ $key = Inflect::propertyToColumn($key);
+ $sql .= "\n `$key` ";
+ $sql .= $this->defineType($val);
+ $sql .= ',';
+ }
+ $sql .= "\nPRIMARY KEY (`id`)\n";
+ $sql .= ") TYPE=$type AUTO_INCREMENT=1 ;";
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Destroys an existing table and all its data
+ */
+ function dropTable($table) {
+ $this->_connection->execute("DROP TABLE `$table`");
+ }
+
+ /**
+ * Renames a table
+ */
+ function renameTable($tableFrom, $tableTo) {
+ $this->_connection->execute("RENAME TABLE `$tableFrom` TO `$tableTo`");
+ }
+
+ /**
+ * Checks if a table exists
+ */
+ function tableExists($table) {
+ $this->_connection->execute("DROP TABLE IF EXISTS `$table``");
+ }
+
+ /**
+ * Rename a table column without altering it's structure
+ */
+ function changeColumn($table, $oldCol, $newCol, $type=false) {
+ if (!$type) {
+ $sql = "SHOW FIELDS FROM `$table` LIKE '$oldCol'";
+ $this->_result = $this->_connection->execute($sql);
+ $field = $this->getObject();
+ $definition = $field->Type;
+ } else {
+ $definition = $this->defineType($type);
+ }
+ $sql = "ALTER TABLE `$table` CHANGE COLUMN $oldCol $newCol ".
$definition;
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Add a new table column
+ */
+ function addColumn($table, $name, $type) {
+ $name = Inflect::propertyToColumn($name);
+ $sql = "ALTER TABLE `$table` ADD COLUMN $name " .
$this->defineType($type);
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Add a new table column
+ */
+ function dropColumn($table, $name) {
+ $name = Inflect::propertyToColumn($name);
+ $sql = "ALTER TABLE `$table` DROP COLUMN $name";
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Add an index to a table
+ */
+ function addIndex($table, $name, $columns) {
+ $name = strtoupper($name);
+ $sql = "ALTER TABLE `$table` ADD INDEX `$name` (".
array_reduce($columns, array($this,'reduceIndexColumns')) .")";
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Reduce colunn names into SQL specific format for an alter table
statement.
+ */
+ private function reduceIndexColumns($accumulate, $column) {
+ $column = Inflect::propertyToColumn($column);
+ if ($accumulate == NULL) {
+ $accumulate = $column;
+ } else {
+ $accumulate .= ",$column";
+ }
+ return $accumulate;
+ }
+
+ /**
+ * Remove a named index on a table
+ */
+ function dropIndex($table, $name) {
+ $name = strtoupper($name);
+ $sql = "DROP INDEX `$name` ON `$table`";
+ $this->_connection->execute($sql);
+ }
+
+ /**
+ * Checks if given table is defined in database
+ *
+ * @return boolean
+ */
+ function hasTable($table) {
+ $sql = "SHOW TABLES LIKE '$table'";
+ return (boolean)mysql_num_rows($this->_connection->execute($sql));
+ }
+
+ /**
+ * Returns the mapping to a framework type class
+ */
+ function definePropertyType($type) {
+ return 'string';
+ }
+
+ /**
+ * Gets native SQL definition for a column type.
+ *
+ * @return string SQL definition
+ */
+ private function defineType($type) {
+ switch($type) {
+ case 'int':
+ case 'integer':
+ case 'number':
+ return "INT(11)";
+ case 'bool':
+ case 'boolean':
+ return "TINYINT(1)";
+ case 'decimal':
+ return "DOUBLE(16,2) ZEROFILL";
+ case 'float':
+ return "DOUBLE(16,8) ZEROFILL";
+ case 'text':
+ return"TEXT NOT NULL default ''";
+ case 'date':
+ return "DATE NOT NULL default '0000-00-00'";
+ case 'datetime':
+ return "DATETIME NOT NULL default '0000-00-00 00:00:00'";
+ case 'raw':
+ return "BLOB NOT NULL default ''";
+ default:
+ return "VARCHAR(255) NOT NULL default ''";
+ }
+ }
+
+}
+
+?>
=======================================
--- /trunk/src/repository/services/mysql/MysqlGateway.class.php Tue Mar 9
17:16:12 2010
+++ /dev/null
@@ -1,367 +0,0 @@
-<?php
-/**
- * This file is part of Floe, a graceful PHP framework.
- * Copyright (C) 2005-2010 Mark Rickerby <
http://maetl.net>
- *
- * See the LICENSE file distributed with this software for full copyright,
disclaimer
- * of liability, and the specific limitations that govern the use of this
software.
- *
- * $Id$
- * @package repository
- * @subpackage store.mysql
- */
-
-require_once 'MysqlIterator.class.php';
-
-/**
- * Gateway for managing common database operations.
- *
- * @package repository
- * @subpackage store.mysql
- */
-class MysqlGateway {
-
- var $_connection;
- var $_result;
- var $_currentTable;
-
- function __construct($connection) {
- $this->_connection = $connection;
- }
-
- function affectedRows() {
- return mysql_affected_rows($this->_result);
- }
-
- /**
- * Returns the last insert id.
- */
- function insertId() {
- return mysql_insert_id();
- }
-
- /**
- * Returns a Record as the result of a select query.
- *
- * @return stdClass
- */
- function getObject() {
- return mysql_fetch_object($this->_result);
- }
-
- /**
- * Returns a single value from the select query result.
- *
- * @return mixed value
- */
- function getValue() {
- $result = mysql_fetch_array($this->_result);
- return $result[0];
- }
-
- /**
- * Returns an array of objects as the result of a select query.
- *
- * @return array<stdClass>
- */
- function getObjects() {
- $i=0; $objects = array();
- while ($row = mysql_fetch_object($this->_result)) {
- $objects[$i] = $row; $i++;
- }
- return $objects;
- }
-
- /**
- * Returns an iterator for traversing the result of a select query.
- *
- * @return Iterator<stdClass>
- */
- function getIterator() {
- return new MysqlIterator($this->_result);
- }
-
- /**
- *
- */
- function selectById($table, $id, $target=false) {
- $this->_currentTable = $table;
- $fields = (!$target) ? '*' : implode(',', array_keys($target));
- $sql = 'SELECT '.$fields.' FROM `'.$table.'` WHERE id="'.$id.'"';
- $this->_result = $this->_connection->execute($sql);
- }
-
- /**
- *
- */
- function selectAll($table) {
- $this->_currentTable = $table;
- $sql = 'SELECT * FROM `'.$table.'`';
- $this->_result = $this->_connection->execute($sql);
- }
-
- /**
- *
- */
- function selectByKey($table, $target) {
- $this->_connection->connect();
- $this->_currentTable = $table;
- $sql = 'SELECT * FROM `'.$table.'` WHERE ';
- $where = '';
- foreach ($target as $key => $value) {
- if($where != "") {
- $where .= "AND ";
- }
- $where .= mysql_real_escape_string($key) .'="'.
mysql_real_escape_string($value) .'" ';
- }
- $sql .= $where;
- $this->_result = $this->_connection->execute($sql);
- }
-
- /**
- *
- */
- function selectByAssociation($table, $join_table, $target=false) {
- $this->_currentTable = $table;
- $sql = "SELECT * FROM `$table`,`$join_table` ";
- $sql .= "WHERE
$
table.id=$join_table.".Inflect::toSingular($table)."_id";
- if ($target) $sql .= " AND
$join_table.".key($target)."='".current($target)."'";
- $this->_result = $this->_connection->execute($sql);
- }
-
- /**
- * Inserts a row into specified table.
- *
- * @param $table string name of the table to insert into
- * @param $columns associative array of column=>value pairs to create
- */
- function insert($table, $columns) {
- $this->_connection->connect();
- $this->_currentTable = $table;
- $keys = array_keys($columns);
- $values = array_values($columns);
- $colnum = count($columns);
- $sql = 'INSERT INTO `'.mysql_real_escape_string($table).'` (';
- for($i=0;$i<$colnum;$i++) {
- $sql .= Inflect::propertyToColumn($keys[$i]);
- $i==($colnum-1) ? $sql .= ')' : $sql .= ',';
- }
- $sql .= ' VALUES (';
- for($i=0;$i<$colnum;$i++) {
- $sql .= '"'.mysql_real_escape_string((string)$values[$i]).'"';
- $i==($colnum-1) ? $sql .= ')' : $sql .= ',';
- }
- $this->_connection->execute($sql);
- }
-
- /**
- * Creates a new row in specified table. Synonym for insert.
- */
- function create($table, $columns) {
- $this->insert($table, $columns);
- }
-
- /**
- * Updates a row in specified table
- */
- function update($table, $target, $columns) {
- $this->_connection->connect();
- $colnum = count($columns);
- $i = 1;
- $sql = 'UPDATE `'.mysql_real_escape_string($table).'` SET ';
- foreach($columns as $field=>$val) {
- $sql .= $field.'="'.mysql_real_escape_string($val).'"';
- $i==$colnum ? $sql .= ' ' : $sql .= ',';
- $i++;
- }
-
$sql .= 'WHERE '.mysql_real_escape_string(key($target)).'="'.mysql_real_escape_string(current($target)).'"';
- $this->_connection->execute($sql);
- }
-
- /**
- * Deletes row(s) specified by column=>value pair
- *
- */
- function delete($table, $target) {
- if (!is_array($target)) return;
- $sql = 'DELETE FROM `'.$table.'` WHERE ';
- $where = '';
- foreach ($target as $key => $value) {
- if($where != "") {
- $where .= "AND ";
- }
- $where .= mysql_real_escape_string($key) .'="'.
mysql_real_escape_string($value) .'" ';
- }
- $this->_connection->execute($sql . $where);
- }
-
- /**
- * Executes an arbitrary SQL query on the connection.
- */
- function query($sql) {
- $this->_result = $this->_connection->execute($sql);
- }
-
- /**
- * Executes an arbitrary SELECT query on the connection.
- */
- function select($table, $clauses) {
- $this->_currentTable = $table;
- $sql = "SELECT * FROM `$table` $clauses";
- $this->_result = $this->_connection->execute($sql);
- }
-
- /**
- * Creates a table with specified columns
- */
- function createTable($table, $rows, $type='MyISAM') {
- $sql = "\nCREATE TABLE `$table` (";
- $sql .= "\nid int(11) NOT NULL auto_increment,";
- foreach($rows as $key=>$val) {
- $key = Inflect::propertyToColumn($key);
- $sql .= "\n `$key` ";
- $sql .= $this->defineType($val);
- $sql .= ',';
- }
- $sql .= "\nPRIMARY KEY (`id`)\n";
- $sql .= ") TYPE=$type AUTO_INCREMENT=1 ;";
- $this->_connection->execute($sql);
- }
-
- /**
- * Destroys an existing table and all its data
- */
- function dropTable($table) {
- $this->_connection->execute("DROP TABLE `$table`");
- }
-
- /**
- * Renames a table
- */
- function renameTable($tableFrom, $tableTo) {
- $this->_connection->execute("RENAME TABLE `$tableFrom` TO `$tableTo`");
- }
-
- /**
- * Checks if a table exists
- */
- function tableExists($table) {
- $this->_connection->execute("DROP TABLE IF EXISTS `$table``");
- }
-
- /**
- * Rename a table column without altering it's structure
- */
- function changeColumn($table, $oldCol, $newCol, $type=false) {
- if (!$type) {
- $sql = "SHOW FIELDS FROM `$table` LIKE '$oldCol'";
- $this->_result = $this->_connection->execute($sql);
- $field = $this->getObject();
- $definition = $field->Type;
- } else {
- $definition = $this->defineType($type);
- }
- $sql = "ALTER TABLE `$table` CHANGE COLUMN $oldCol $newCol ".
$definition;
- $this->_connection->execute($sql);
- }
-
- /**
- * Add a new table column
- */
- function addColumn($table, $name, $type) {
- $name = Inflect::propertyToColumn($name);
- $sql = "ALTER TABLE `$table` ADD COLUMN $name " .
$this->defineType($type);
- $this->_connection->execute($sql);
- }
-
- /**
- * Add a new table column
- */
- function dropColumn($table, $name) {
- $name = Inflect::propertyToColumn($name);
- $sql = "ALTER TABLE `$table` DROP COLUMN $name";
- $this->_connection->execute($sql);
- }
-
- /**
- * Add an index to a table
- */
- function addIndex($table, $name, $columns) {
- $name = strtoupper($name);
- $sql = "ALTER TABLE `$table` ADD INDEX `$name` (".
array_reduce($columns, array($this,'reduceIndexColumns')) .")";
- $this->_connection->execute($sql);
- }
-
- /**
- * Reduce colunn names into SQL specific format for an alter table
statement.
- */
- private function reduceIndexColumns($accumulate, $column) {
- $column = Inflect::propertyToColumn($column);
- if ($accumulate == NULL) {
- $accumulate = $column;
- } else {
- $accumulate .= ",$column";
- }
- return $accumulate;
- }
-
- /**
- * Remove a named index on a table
- */
- function dropIndex($table, $name) {
- $name = strtoupper($name);
- $sql = "DROP INDEX `$name` ON `$table`";
- $this->_connection->execute($sql);
- }
-
- /**
- * Checks if given table is defined in database
- *
- * @return boolean
- */
- function hasTable($table) {
- $sql = "SHOW TABLES LIKE '$table'";
- return (boolean)mysql_num_rows($this->_connection->execute($sql));
- }
-
- /**
- * Returns the mapping to a framework type class
- */
- function definePropertyType($type) {
- return 'string';
- }
-
- /**
- * Gets native SQL definition for a column type.
- *
- * @return string SQL definition
- */
- private function defineType($type) {
- switch($type) {
- case 'int':
- case 'integer':
- case 'number':
- return "INT(11)";
- case 'bool':
- case 'boolean':
- return "TINYINT(1)";
- case 'decimal':
- return "DOUBLE(16,2) ZEROFILL";
- case 'float':
- return "DOUBLE(16,8) ZEROFILL";
- case 'text':
- return"TEXT NOT NULL default ''";
- case 'date':
- return "DATE NOT NULL default '0000-00-00'";
- case 'datetime':
- return "DATETIME NOT NULL default '0000-00-00 00:00:00'";
- case 'raw':
- return "BLOB NOT NULL default ''";
- default:
- return "VARCHAR(255) NOT NULL default ''";
- }
- }
-
-}
-
-?>
=======================================
--- /trunk/src/repository/Storage.class.php Sun May 23 12:01:36 2010
+++ /trunk/src/repository/Storage.class.php Sun May 23 12:12:02 2010
@@ -8,51 +8,46 @@
*
* $Id$
* @package repository
- * @subpackage store
*/
-if (!defined('StorageAdaptor_DefaultInstance'))
define('StorageAdaptor_DefaultInstance', 'Mysql');
+if (!defined('Storage_DefaultInstance'))
define('Storage_DefaultInstance', 'Mysql');
/**
- * High level wrapper around the gateway to a specific storage engine.
+ * Wrapper around the adaptor to a specific storage engine.
*
* @package repository
- * @subpackage store
*/
-class StorageAdaptor {
-
- private static $adaptor = null;
+class Storage {
+
+ private static $storageAdaptor = null;
private static $implementation = null;
private $currentRecordType;
+ private $adaptor;
/**
- * Access a singleton instance of the StorageAdaptor
+ * Access a global instance of the Storage wrapper.
*/
- static function instance($adaptor = 'Mysql') {
- if (!self::$adaptor) self::$adaptor = new
StorageAdaptor(self::gateway());
- return self::$adaptor;
+ static function init($adaptor = false) {
+ if (!self::$storageAdaptor) self::$storageAdaptor = new
StorageAdaptor(self::service());
+ return self::$storageAdaptor;
}
/**
- * Returns a default instance
+ * Access a global instance of a service adaptor.
*/
- static function gateway($adaptor = 'Mysql') {
- $adaptor = ($adaptor) ? $adaptor : StorageAdaptor_DefaultInstance;
- $queryAdaptor = $adaptor.'Gateway';
- $queryConnection = $adaptor."Connection";
- require_once 'store/'. strtolower($adaptor) .'/'.
$queryAdaptor .'.class.php';
- require_once 'store/'. strtolower($adaptor) .'/'.
$queryConnection .'.class.php';
+ static function service($adaptor = false) {
+ $adaptor = ($adaptor) ? $adaptor : Storage_DefaultInstance;
+ $serviceAdaptor = $adaptor.'Adaptor';
+ require_once 'service/'. strtolower($adaptor) .'/'.
$queryAdaptor .'.class.php';
if (!self::$implementation) self::$implementation = new
$queryAdaptor(new $queryConnection());
return self::$implementation;
}
-
- private $gateway;
/**
* @ignore
*/
function __construct($gateway) {
- $this->gateway = $gateway;
+ $this->adaptor = $gateway;
}
/**
@@ -87,7 +82,7 @@
*/
function getRecords() {
$type = $this->currentRecordType;
- $objects = $this->gateway->getObjects();
+ $objects = $this->adaptor->getObjects();
foreach($objects as $object) {
$records[] = new $type($object);
}
@@ -99,7 +94,7 @@
* @return stdClass
*/
function getObject() {
- return $this->gateway->getObject();
+ return $this->adaptor->getObject();
}
/**
@@ -107,21 +102,21 @@
* @return array<strClass>
*/
function getObjects() {
- return $this->gateway->getObjects();
+ return $this->adaptor->getObjects();
}
/**
* Provides a single value from a query result.
*/
function getValue() {
- return $this->gateway->getValue();
+ return $this->adaptor->getValue();
}
/**
* Provides an iterator over a result set.
*/
function getIterator() {
- return $this->gateway->getIterator();
+ return $this->adaptor->getIterator();
}
/**
@@ -129,7 +124,7 @@
*/
function selectById($table, $id) {
$this->setRecordType($table);
- return $this->gateway->selectById($table, $id);
+ return $this->adaptor->selectById($table, $id);
}
/**
@@ -137,7 +132,7 @@
*/
function selectByKey($table, $key) {
$this->setRecordType($table);
- return $this->gateway->selectByKey($table, $key);
+ return $this->adaptor->selectByKey($table, $key);
}
/**
@@ -145,7 +140,7 @@
*/
function selectAll($table) {
$this->setRecordType($table);
- return $this->gateway->selectAll($table);
+ return $this->adaptor->selectAll($table);
}
/**
@@ -153,7 +148,7 @@
*/
function select($table, $target) {
$this->setRecordType($table);
- return $this->gateway->select($table, $target);
+ return $this->adaptor->select($table, $target);
}
/**
@@ -161,14 +156,14 @@
*/
function selectByAssociation($table, $join_table, $target=false) {
$this->setRecordType($table);
- return $this->gateway->selectByAssociation($table, $join_table,
$target);
+ return $this->adaptor->selectByAssociation($table, $join_table,
$target);
}
/**
* @todo extract to SqlAdaptor interface
*/
function insertId() {
- return $this->gateway->insertId();
+ return $this->adaptor->insertId();
}
/**
@@ -176,7 +171,7 @@
*/
function insert($table, $properties) {
$this->setRecordType($table);
- return $this->gateway->insert($table, $properties);
+ return $this->adaptor->insert($table, $properties);
}
/**
@@ -184,7 +179,7 @@
*/
function update($table, $target, $properties) {
$this->setRecordType($table);
- return $this->gateway->update($table, $target, $properties);
+ return $this->adaptor->update($table, $target, $properties);
}
/**
@@ -192,7 +187,7 @@
*/
function delete($table, $matching) {
$this->setRecordType($table);
- return $this->gateway->delete($table, $matching);
+ return $this->adaptor->delete($table, $matching);
}
/**
@@ -201,7 +196,7 @@
*/
function query($statement) {
if (is_object($statement)) $this->setRecordType($statement->tableName);
- return $this->gateway->query($statement);
+ return $this->adaptor->query($statement);
}
/**
@@ -209,7 +204,7 @@
*/
function createTable($name, $properties) {
$this->setRecordType($name);
- return $this->gateway->createTable($name, $properties);
+ return $this->adaptor->createTable($name, $properties);
}
/**
@@ -217,7 +212,7 @@
*/
function dropTable($name) {
$this->setRecordType($name);
- return $this->gateway->dropTable($name);
+ return $this->adaptor->dropTable($name);
}
/**
@@ -225,7 +220,7 @@
*/
function addColumn($table, $column, $type) {
$this->setRecordType($table);
- return $this->gateway->addColumn($table, $column, $type);
+ return $this->adaptor->addColumn($table, $column, $type);
}
/**
@@ -233,7 +228,7 @@
*/
function dropColumn($table, $column) {
$this->setRecordType($table);
- return $this->gateway->dropColumn($table, $column);
+ return $this->adaptor->dropColumn($table, $column);
}
}
--
You received this message because you are subscribed to the Google Groups "Floe Commits" group.
To post to this group, send email to
floe-c...@googlegroups.com.
To unsubscribe from this group, send email to
floe-commits...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/floe-commits?hl=en.