summaryrefslogtreecommitdiff
path: root/framework/DataAccess
diff options
context:
space:
mode:
Diffstat (limited to 'framework/DataAccess')
-rw-r--r--framework/DataAccess/TAdodbProvider.php47
-rw-r--r--framework/DataAccess/TCreoleProvider.php5
-rw-r--r--framework/DataAccess/TDatabaseException.php11
-rw-r--r--framework/DataAccess/TDatabaseProvider.php74
4 files changed, 62 insertions, 75 deletions
diff --git a/framework/DataAccess/TAdodbProvider.php b/framework/DataAccess/TAdodbProvider.php
index d4b6cf30..65e336a9 100644
--- a/framework/DataAccess/TAdodbProvider.php
+++ b/framework/DataAccess/TAdodbProvider.php
@@ -1,11 +1,10 @@
<?php
Prado::using('System.DataAccess.TDatabaseProvider');
-Prado::using('System.DataAccess.TDatabaseException');
/**
* Adbodb data access module.
- *
+ *
* Usage:
* <code>
* $provider = new TAdodbProvider;
@@ -100,7 +99,7 @@ class TAdodbProvider extends TDatabaseProvider
public function setFetchMode($value)
{
$value = strtolower($value);
- if($value===self::FETCH_ASSOCIATIVE || $value===self::FETCH_NUMERIC
+ if($value===self::FETCH_ASSOCIATIVE || $value===self::FETCH_NUMERIC
|| $value===self::FETCH_BOTH)
$this->_fetchMode=$value;
else
@@ -163,24 +162,24 @@ class TAdodbConnection extends TDbConnection
return call_user_func_array(array($this->_connection,$method),$params);
}
- /**
- * Cleanup work before serializing.
- * This is a PHP defined magic method.
- * @return array the names of instance-variables to serialize.
- */
- public function __sleep()
- {
- $this->close();
- return array_keys(get_object_vars($this));
- }
-
- /**
- * This method will be automatically called when unserialization happens.
- * This is a PHP defined magic method.
- */
- public function __wakeup()
- {
- }
+ /**
+ * Cleanup work before serializing.
+ * This is a PHP defined magic method.
+ * @return array the names of instance-variables to serialize.
+ */
+ public function __sleep()
+ {
+ $this->close();
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * This method will be automatically called when unserialization happens.
+ * This is a PHP defined magic method.
+ */
+ public function __wakeup()
+ {
+ }
public function getIsClosed()
@@ -265,7 +264,7 @@ class TAdodbConnection extends TDbConnection
$this->initCacheDir();
}
return $this->_connection->IsConnected();
- }
+ }
/**
* Complete the database connection.
@@ -285,7 +284,7 @@ class TAdodbConnection extends TDbConnection
$this->_connection->Connect($provider->getHost(),
$provider->getUsername(),$provider->getPassword(),
$provider->getDatabase());
- }
+ }
}
/**
@@ -329,7 +328,7 @@ class TAdodbConnection extends TDbConnection
/**
* @param string quote a string to be sent to the database.
- * @param boolean if true it ensure that the variable is not quoted twice,
+ * @param boolean if true it ensure that the variable is not quoted twice,
* once by quote and once by the magic_quotes_gpc.
* @return string database specified quoted string
*/
diff --git a/framework/DataAccess/TCreoleProvider.php b/framework/DataAccess/TCreoleProvider.php
index 51b7013a..f4ccd4c2 100644
--- a/framework/DataAccess/TCreoleProvider.php
+++ b/framework/DataAccess/TCreoleProvider.php
@@ -1,7 +1,6 @@
<?php
Prado::using('System.DataAccess.TDatabaseProvider');
-Prado::using('System.DataAccess.TDatabaseException');
Prado::using('System.DataAccess.creole.*');
@@ -61,7 +60,7 @@ class TCreoleConnection extends TDbConnection
return $this->_connection->prepareStatement($statement);
}
- //public function execute($sql,
+ //public function execute($sql,
/**
* Opens a database connection with settings provided in the ConnectionString.
@@ -75,7 +74,7 @@ class TCreoleConnection extends TDbConnection
throw new TDbConnectionException('db_driver_required');
$class = 'System.DataAccess.creole.creole.Creole';
$creole = Prado::createComponent($class);
- $this->_connection = $creole->getConnection($connectionString);
+ $this->_connection = $creole->getConnection($connectionString);
}
return $this->_connection;
}
diff --git a/framework/DataAccess/TDatabaseException.php b/framework/DataAccess/TDatabaseException.php
deleted file mode 100644
index 7d01bbc5..00000000
--- a/framework/DataAccess/TDatabaseException.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-class TDatabaseException extends TException
-{
-}
-
-class TDbConnectionException extends TDatabaseException
-{
-}
-
-?> \ No newline at end of file
diff --git a/framework/DataAccess/TDatabaseProvider.php b/framework/DataAccess/TDatabaseProvider.php
index 8f676345..68cae473 100644
--- a/framework/DataAccess/TDatabaseProvider.php
+++ b/framework/DataAccess/TDatabaseProvider.php
@@ -1,7 +1,7 @@
<?php
/**
- * Database access module.
+ * Database access module.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Revision: $ $Date: $
@@ -143,37 +143,7 @@ abstract class TDatabaseProvider extends TModule
}
/**
- * Performs the connection to the database using a TDatabaseProvider,
- * executes SQL statements.
- *
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @version $Revision: $ $Date: $
- * @package System.DataAccess
- * @since 3.0
- */
-abstract class TDbConnection extends TComponent implements IDbConnection
-{
- private $_provider;
-
- public function __construct($provider)
- {
- if($provider instanceof TDatabaseProvider)
- $this->setProvider($provider);
- }
-
- public function setProvider($provider)
- {
- $this->_provider = $provider;
- }
-
- public function getProvider()
- {
- return $this->_provider;
- }
-}
-
-/**
- * A connection (session) with a specific database. SQL statements are executed
+ * A connection (session) with a specific database. SQL statements are executed
* and results are returned within the context of a connection.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
@@ -199,13 +169,13 @@ interface IDbConnection
public function open();
/**
- * @return string creates a prepared statement for sending parameterized
+ * @return string creates a prepared statement for sending parameterized
* SQL statements to the database.
*/
public function prepare($statement);
/**
- * Executes the SQL statement which may be any kind of SQL statement,
+ * Executes the SQL statement which may be any kind of SQL statement,
* including prepared statements.
* @param string sql query statement
* @param array subsititution parameters
@@ -234,20 +204,20 @@ interface IDbConnection
public function getHasTransactionFailed();
/**
- * Makes all changes made since the previous commit/rollback permanent and
+ * Makes all changes made since the previous commit/rollback permanent and
* releases any database locks.
*/
public function commit();
/**
- * Undoes all changes made in the current transaction and releases any
+ * Undoes all changes made in the current transaction and releases any
* database locks
*/
public function rollback();
/**
* @param string quote a string to be sent to the database.
- * @param boolean if true it ensure that the variable is not quoted twice,
+ * @param boolean if true it ensure that the variable is not quoted twice,
* once by quote and once by the magic_quotes_gpc.
* @return string database specified quoted string
*/
@@ -255,4 +225,34 @@ interface IDbConnection
}
+/**
+ * Performs the connection to the database using a TDatabaseProvider,
+ * executes SQL statements.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Revision: $ $Date: $
+ * @package System.DataAccess
+ * @since 3.0
+ */
+abstract class TDbConnection extends TComponent implements IDbConnection
+{
+ private $_provider;
+
+ public function __construct($provider)
+ {
+ if($provider instanceof TDatabaseProvider)
+ $this->setProvider($provider);
+ }
+
+ public function setProvider($provider)
+ {
+ $this->_provider = $provider;
+ }
+
+ public function getProvider()
+ {
+ return $this->_provider;
+ }
+}
+
?> \ No newline at end of file