summaryrefslogtreecommitdiff
path: root/framework/Data/TDbConnection.php
diff options
context:
space:
mode:
authorxue <>2006-11-24 19:15:26 +0000
committerxue <>2006-11-24 19:15:26 +0000
commit7280a2301a3d3dd251d8302c3f7999fa09780d42 (patch)
tree4436f61f268a79271ccf7c01fdab7a5be5c50106 /framework/Data/TDbConnection.php
parent88a073ccbb0026e52d2f83aeeaab4bd9591ef3ab (diff)
bug fixes of data layer.
Diffstat (limited to 'framework/Data/TDbConnection.php')
-rw-r--r--framework/Data/TDbConnection.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php
index cfb4fd72..9ca57a4a 100644
--- a/framework/Data/TDbConnection.php
+++ b/framework/Data/TDbConnection.php
@@ -20,7 +20,7 @@ Prado::using('System.Data.TDbCommand');
*
* TDbConnection works together with {@link TDbCommand}, {@link TDbDataReader}
* and {@link TDbTransaction} to provide data access to various DBMS
- * in a common set of APIs, thanks to the {@link http://www.php.net/manual/en/ref.pdo.php PDO}
+ * in a common set of APIs. They are a thin wrapper of the {@link http://www.php.net/manual/en/ref.pdo.php PDO}
* PHP extension.
*
* To establish a connection, set {@link setActive Active} to true after
@@ -53,9 +53,9 @@ Prado::using('System.Data.TDbCommand');
*
* To use transaction, do like the following:
* <code>
+ * $transaction=$connection->beginTransaction();
* try
* {
- * $transaction=$connection->beginTransaction();
* $connection->createCommand($sql1)->execute();
* $connection->createCommand($sql2)->execute();
* //.... other SQL executions
@@ -136,8 +136,8 @@ class TDbConnection extends TComponent
{
try
{
- $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->_pdo=new PDO($this->getConnectionString(),$this->getUsername(),$this->getPassword(),$this->_attributes);
+ $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->_active=true;
}
catch(PDOException $e)
@@ -454,7 +454,7 @@ class TDbConnection extends TComponent
*/
public function setAttribute($name,$value)
{
- if($this->getActive())
+ if($this->_pdo instanceof PDO)
$this->_pdo->setAttribute($name,$value);
else
$this->_attributes[$name]=$value;