creole.common
[ class tree: creole.common ] [ index: creole.common ] [ all elements ]

Class: ConnectionCommon

Source Location: /creole/common/ConnectionCommon.php

Class Overview


Class that contains some shared/default information for connections. Classes may wish to extend this so as not to worry about the sleep/wakeup methods, etc.


Author(s):

Version:

  • $Revision: 1.3 $

Variables

Methods


Child classes:

MSSQLConnection
MS SQL Server implementation of Connection.
MySQLConnection
MySQL implementation of Connection.
ODBCConnection
ODBC implementation of Connection.
OCI8Connection
Oracle implementation of Connection.
PgSQLConnection
PgSQL implementation of Connection.
SQLiteConnection
SQLite implementation of Connection.

Class Details

[line 32]
Class that contains some shared/default information for connections. Classes may wish to extend this so as not to worry about the sleep/wakeup methods, etc.

In reality this class is not very useful yet, so there's not much incentive for drivers to extend this.




Tags:

abstract:  
version:  $Revision: 1.3 $
author:  Hans Lellelid <hans@xmpl.org>


[ Top ]


Class Variables

$autocommit =  true

[line 52]



Tags:

access:  protected

Type:   boolean


[ Top ]

$dblink =

[line 58]

DB connection resource id.



Tags:

access:  protected

Type:   resource


[ Top ]

$dsn =

[line 64]

Array hash of connection properties.



Tags:

access:  protected

Type:   array


[ Top ]

$flags =  0

[line 70]

Flags (e.g. Connection::PERSISTENT) for current connection.



Tags:

access:  protected

Type:   int


[ Top ]

$transactionOpcount =  0

[line 47]

The depth level of current transaction.



Tags:

access:  protected

Type:   int


[ Top ]



Class Methods


method getAutoCommit [line 154]

boolean getAutoCommit( )

Get auto-commit status.



Tags:

access:  public


[ Top ]

method getDSN [line 126]

void getDSN( )



Tags:

access:  public
see:  Connection::getDSN()


[ Top ]

method getFlags [line 133]

void getFlags( )



Tags:

access:  public
see:  Connection::getFlags()


[ Top ]

method getResource [line 118]

void getResource( )



Tags:

access:  public
see:  Connection::getResource()


[ Top ]

method prepareCall [line 144]

CallableStatement prepareCall( string $sql)

Creates a CallableStatement object for calling database stored procedures.



Tags:

access:  public


Overridden in child classes as:

MSSQLConnection::prepareCall()
Creates a CallableStatement object for calling database stored procedures.
MySQLConnection::prepareCall()
ODBCConnection::prepareCall()
OCI8Connection::prepareCall()
PgSQLConnection::prepareCall()
SQLiteConnection::prepareCall()

Parameters:

string   $sql  

[ Top ]

method setAutoCommit [line 170]

void setAutoCommit( boolean $bit)

Enable/disable automatic commits.

Pushes SQLWarning onto $warnings stack if the autocommit value is being changed mid-transaction. This function is overridden by driver classes so that they can perform the necessary begin/end transaction SQL.

If auto-commit is being set to TRUE, then the current transaction will be committed immediately.




Tags:

access:  public


Overridden in child classes as:

ODBCConnection::setAutoCommit()

Parameters:

boolean   $bit   New value for auto commit.

[ Top ]

method __sleep [line 99]

array __sleep( )

This "magic" method is invoked upon serialize() and works in tandem with the __wakeup() method to ensure that your database connection is serializable.

This method returns an array containing the names of any members of your class which need to be serialized in order to allow the class to re-connect to the database when it is unserialized.

<p> Developers:

Note that you cannot serialize resources (connection links) and expect them to be valid when you unserialize. For this reason, you must re-connect to the database in the __wakeup() method.

It's up to your class implimentation to ensure that the necessary data is serialized. You probably at least need to serialize:

(1) the DSN array used by connect() method (2) Any flags that were passed to the connection (3) Possibly the autocommit state




Tags:

return:  The class variable names that should be serialized.
access:  public
see:  DatabaseInfo::__sleep()
see:  DriverManager::getConnection()
see:  ConnectionCommon::__wakeup()


[ Top ]

method __wakeup [line 110]

void __wakeup( )

This "magic" method is invoked upon unserialize().

This method will re-connects to the database using the information that was stored using the __sleep() method.




Tags:

access:  public
see:  ConnectionCommon::__sleep()


[ Top ]


Documentation generated on Mon, 23 Aug 2004 21:51:19 -0400 by phpDocumentor 1.3.0RC3