\PDO

Class PDO PostgreSQL, SQLITE and MYSQL PDO support for PHP 4.X.X or PHP 5.0.X users, compatible with PHP 5.1.0 (RC1).

DESCRIPTION [directly from http://us2.php.net/manual/en/ref.pdo.php] The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions. Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.

HOW TO USE To know how to use PDO driver and all its methods visit php.net wonderful documentation. http://us2.php.net/manual/en/ref.pdo.php In this class some methods are not available and actually this porting is only for MySQL, SQLITE and PostgreSQL.

LIMITS For some reasons ( time and php used version with this class ) some PDO methods are not availables and someother are not totally supported.

PDO :: UNSUPPORTED METHODS:

  • beginTransaction [ mysql 3 has not transaction and manage them is possible only with a direct BEGIN or COMMIT query ]

    • commit
    • rollback

    PDO :: NOT TOTALLY SUPPORTED METHODS:

  • getAttribute [ accepts only PDO_ATTR_SERVER_INFO, PDO_ATTR_SERVER_VERSION, PDO_ATTR_CLIENT_VERSION and PDO_ATTR_PERSISTENT attributes ]

    • setAttribute [ supports only PDO_ATTR_PERSISTENT modification ]
    • lastInsertId [ only fo PostgreSQL , returns only pg_last_oid ]

    PDOStatement :: UNSUPPORTED METHODS:

  • bindColumn [ is not possible to undeclare a variable and using global scope is not really a good idea ]

    PDOStatement :: NOT TOTALLY SUPPORTED METHODS:

  • getAttribute [ accepts only PDO_ATTR_SERVER_INFO, PDO_ATTR_SERVER_VERSION, PDO_ATTR_CLIENT_VERSION and PDO_ATTR_PERSISTENT attributes ]
    • setAttribute [ supports only PDO_ATTR_PERSISTENT modification ]
    • setFetchMode [ supports only PDO_FETCH_NUM, PDO_FETCH_ASSOC, PDO_FETCH_OBJ and PDO_FETCH_BOTH database reading mode ]

Summary

Methods
Properties
Constants
PDO()
beginTransaction()
close()
commit()
exec()
errorCode()
errorInfo()
getAttribute()
lastInsertId()
prepare()
query()
quote()
rollBack()
setAttribute()
__getDNS()
$__driver
FETCH_ASSOC
FETCH_NUM
FETCH_BOTH
FETCH_OBJ
FETCH_LAZY
FETCH_BOUND
ATTR_SERVER_VERSION
ATTR_CLIENT_VERSION
ATTR_SERVER_INFO
ATTR_PERSISTENT
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

FETCH_ASSOC

FETCH_ASSOC = PDO_FETCH_ASSOC

Modified on 2005/12/01 to support new PDO constants on PHP 5.1.X

FETCH_NUM

FETCH_NUM = PDO_FETCH_NUM

FETCH_BOTH

FETCH_BOTH = PDO_FETCH_BOTH

FETCH_OBJ

FETCH_OBJ = PDO_FETCH_OBJ

FETCH_LAZY

FETCH_LAZY = PDO_FETCH_LAZY

FETCH_BOUND

FETCH_BOUND = PDO_FETCH_BOUND

ATTR_SERVER_VERSION

ATTR_SERVER_VERSION = PDO_ATTR_SERVER_VERSION

ATTR_CLIENT_VERSION

ATTR_CLIENT_VERSION = PDO_ATTR_CLIENT_VERSION

ATTR_SERVER_INFO

ATTR_SERVER_INFO = PDO_ATTR_SERVER_INFO

ATTR_PERSISTENT

ATTR_PERSISTENT = PDO_ATTR_PERSISTENT

Properties

$__driver

$__driver : 

'Private' variables: __driver:PDO_* Dedicated PDO database class

Type

Methods

PDO()

PDO(  $string_dsn,   $string_username = '',   $string_password = '',   $array_driver_options = null) 

Public constructor http://us2.php.net/manual/en/function.pdo-construct.php

Parameters

$string_dsn
$string_username
$string_password
$array_driver_options

beginTransaction()

beginTransaction() 

UNSUPPORTED Public method http://us2.php.net/manual/en/function.pdo-begintransaction.php

close()

close() 

NOT NATIVE BUT MAYBE USEFULL FOR PHP < 5.1 PDO DRIVER Public method Calls database_close function.

this->close( Void ):Boolean

commit()

commit() 

UNSUPPORTED Public method http://us2.php.net/manual/en/function.pdo-commit.php

exec()

exec(  $query) 

Public method http://us2.php.net/manual/en/function.pdo-exec.php

Parameters

$query

errorCode()

errorCode() 

Public method http://us2.php.net/manual/en/function.pdo-errorcode.php

errorInfo()

errorInfo() 

Public method http://us2.php.net/manual/en/function.pdo-errorinfo.php

getAttribute()

getAttribute(  $attribute) 

NOT TOTALLY UNSUPPORTED Public method http://us2.php.net/manual/en/function.pdo-getattribute.php

Parameters

$attribute

lastInsertId()

lastInsertId() 

Public method http://us2.php.net/manual/en/function.pdo-lastinsertid.php

prepare()

prepare(  $query,   $array = array()) 

Public method http://us2.php.net/manual/en/function.pdo-prepare.php

Parameters

$query
$array

query()

query(  $query) 

Public method http://us2.php.net/manual/en/function.pdo-query.php

Parameters

$query

quote()

quote(  $string) 

Public method http://us2.php.net/manual/en/function.pdo-quote.php

Parameters

$string

rollBack()

rollBack() 

UNSUPPORTED Public method http://us2.php.net/manual/en/function.pdo-rollback.php

setAttribute()

setAttribute(  $attribute,   $mixed) 

NOT TOTALLY UNSUPPORTED Public method http://us2.php.net/manual/en/function.pdo-setattribute.php

Parameters

$attribute
$mixed

__getDNS()

__getDNS(  $string) 

Parameters

$string