Class jDbConnection

Description
  • abstract:

Located in /db/jDbConnection.class.php (line 23)


	
			
Direct descendents
Variable Summary
mixed $dbms
mixed $lastQuery
string $msgError
array $profil
mixed $_connection
Method Summary
jDbConnection __construct (array $profil)
void __destruct ()
void commit ()
integer errorCode ()
string errorInfo ()
integer exec (string $query)
string getAttribute (integer $id)
boolean hasTablePrefix ()
void lastIdInTable ( $fieldName,  $tableName)
integer lastInsertId ([string $fromSequence = ''])
jDbResultSet|boolean limitQuery (string $queryString, integer $limitOffset, integer $limitCount)
string prefixTable ( $table_name, string $table)
statement prepare (string $query)
jDbResultSet|boolean query (string $queryString)
string quote (string $text, [boolean $checknull = true])
void rollback ()
void setAttribute (integer $id, string $value)
void setAutoCommit ([boolean $state = true])
void _autoCommitNotify (boolean $state)
integer _connect ()
void _disconnect ()
jDbResultSet/boolean _doExec ( $queryString)
jDbResultSet/boolean _doLimitQuery ( $queryString,  $offset,  $number)
jDbResultSet/boolean _doQuery ( $queryString)
void _quote ( $text)
Variables
mixed $dbms (line 34)

The database type name (mysql, pgsql ...)

  • access: public
mixed $lastQuery (line 45)

last executed query

  • access: public
string $msgError = '' (line 40)

The last error message if any

  • access: public
array $profil (line 29)

profil properties used by the connector

  • access: public
mixed $_connection = null (line 56)

the internal connection.

  • access: protected
Methods
Constructor __construct (line 62)

do a connection to the database, using properties of the given profil

jDbConnection __construct (array $profil)
  • array $profil: profil properties

Redefined in descendants as:
Destructor __destruct (line 68)
void __destruct ()

Redefined in descendants as:
beginTransaction (line 161)

begin a transaction. Call it after doQuery, doLimitQuery, doExec,

And then commit() or rollback()

  • abstract:
  • access: public
void beginTransaction ()

Redefined in descendants as:
commit (line 166)

validate all queries and close a transaction

  • abstract:
  • access: public
void commit ()

Redefined in descendants as:
errorCode (line 188)
  • return: the last error code
  • abstract:
  • access: public
integer errorCode ()

Redefined in descendants as:
errorInfo (line 183)
  • return: the last error description
  • abstract:
  • access: public
string errorInfo ()

Redefined in descendants as:
exec (line 103)

Launch a SQL Query (update, delete..) which doesn't return rows

  • return: the number of affected rows. False if the query has failed.
  • access: public
integer exec (string $query)
  • string $query: the SQL query
getAttribute (line 203)

Not implemented

  • return: the attribute value
  • access: public
string getAttribute (integer $id)
  • integer $id: the attribut id
hasTablePrefix (line 144)

Check if the current connection has a table prefix set

  • author: Julien Issler
  • since: 1.0
  • access: public
boolean hasTablePrefix ()
lastIdInTable (line 215)
  • access: public
void lastIdInTable ( $fieldName,  $tableName)
  • $fieldName
  • $tableName
lastInsertId (line 196)

return the id value of the last inserted row.

Some driver need a sequence name, so give it at first parameter

  • return: the id value
  • abstract:
  • access: public
integer lastInsertId ([string $fromSequence = ''])
  • string $fromSequence: the sequence name

Redefined in descendants as:
limitQuery (line 92)

Launch a SQL Query with limit parameter (so only a subset of a result)

  • return: SQL Select. False if the query has failed.
  • access: public
jDbResultSet|boolean limitQuery (string $queryString, integer $limitOffset, integer $limitCount)
  • string $queryString: the SQL query
  • integer $limitOffset: the offset of the first row to return
  • integer $limitCount: the maximum of number of rows to return
prefixTable (line 131)

Prefix the given table with the prefix specified in the connection's profile If there's no prefix for the connection's profile, return the table's name unchanged.

  • return: the prefixed table's name
  • author: Julien Issler
  • since: 1.0
  • access: public
string prefixTable ( $table_name, string $table)
  • string $table: the table's name
  • $table_name
prepare (line 178)

prepare a query

  • return: a statement
  • abstract:
  • access: public
statement prepare (string $query)
  • string $query: a sql query with parameters

Redefined in descendants as:
query (line 79)

Launch a SQL Query which returns rows (typically, a SELECT statement)

  • return: False if the query has failed.
  • access: public
jDbResultSet|boolean query (string $queryString)
  • string $queryString: the SQL query
quote (line 115)

Escape and quotes strings. if null, will only return the text "NULL"

  • return: escaped string
  • access: public
string quote (string $text, [boolean $checknull = true])
  • string $text: string to quote
  • boolean $checknull: if true, check if $text is a null value, and then return NULL
rollback (line 171)

cancel all queries of a transaction and close the transaction

  • abstract:
  • access: public
void rollback ()

Redefined in descendants as:
setAttribute (line 210)

Not implemented

  • access: public
void setAttribute (integer $id, string $value)
  • integer $id: the attribut id
  • string $value: the attribute value
setAutoCommit (line 152)

sets the autocommit state

  • access: public
void setAutoCommit ([boolean $state = true])
  • boolean $state: state the status of autocommit
_autoCommitNotify (line 228)

Notify the changes on autocommit

Drivers may overload this

  • abstract:
  • access: protected
void _autoCommitNotify (boolean $state)
  • boolean $state: state the new state of autocommit

Redefined in descendants as:
_connect (line 234)

return a connection identifier or false/null if there is an error

  • return: connection identifier
  • abstract:
  • access: protected
integer _connect ()

Redefined in descendants as:
_disconnect (line 240)

do a disconnection

(no need to do a test on the connection id)

  • abstract:
  • access: protected
void _disconnect ()

Redefined in descendants as:
_doExec (line 251)

do a query which return nothing

  • abstract:
  • access: protected
jDbResultSet/boolean _doExec ( $queryString)
  • $queryString

Redefined in descendants as:
_doLimitQuery (line 257)

do a query which return a limited number of results

  • abstract:
  • access: protected
jDbResultSet/boolean _doLimitQuery ( $queryString,  $offset,  $number)
  • $queryString
  • $offset
  • $number

Redefined in descendants as:
_doQuery (line 246)

do a query which return results

  • abstract:
  • access: protected
jDbResultSet/boolean _doQuery ( $queryString)
  • $queryString

Redefined in descendants as:
_quote (line 263)

do the escaping of a string.

you should override it into the driver

  • access: protected
void _quote ( $text)
  • $text

Redefined in descendants as:

Documentation generated on Wed, 07 Sep 2011 13:47:11 +0200 by phpDocumentor 1.4.3