PhpMyObject
[ class tree: PhpMyObject ] [ index: PhpMyObject ] [ all elements ]

Class: PMO_MyDbms

Source Location: /fichiers/v0.15/PMO_core/PMO_MyDbms.php

Class Overview


This class describe a generic Dbms object. It's a factory abstraction that permits to instanciate driver like mysql, postgresql, pdo etc ...


Author(s):

Implements interfaces:

Variables

Methods


Child classes:

PMO_Dbms_Mysql
This class implements the MySql driver.
PMO_Dbms_Mysqli
This class implements a MySqli driver.
PMO_Dbms_Pdo
This class implements a PDO driver.
PMO_Dbms_Pgsql
This class implements a PostgreSql driver.

Class Details

[line 50]
This class describe a generic Dbms object. It's a factory abstraction that permits to instanciate driver like mysql, postgresql, pdo etc ...

This class also implements generic methods used by all drivers




Tags:

abstract:  


[ Top ]


Class Variables

static $INSTANCE =

[line 57]

current PMO_Dbbms instance



Tags:

access:  protected

Type:   object


[ Top ]

$db =

[line 64]

a PMO_Dbms object or a database resource link



Tags:

access:  protected

Type:   object|resource


[ Top ]

$log = array()

[line 71]

holds the queries log



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


static method factory [line 95]

static PMO_Dbms factory( [ $object = NULL])

returns a reference to the PMO_Dbms object If it does not already exists a new object is created and retained for future use

if an PDO object is provided as parameter, it will be used and will replace any existing instance.

This uses the singleton design pattern. To get the object, use code such as this:

  1.  // either returns an existing instance or creates a new one and returns it
  2.  $db PMO_MyDbms::factory();
  3.  
  4.  // use an already defined PDO instance
  5.  $pdo new PDO("sqlite:/hoem/user/db/mydatabase.db");
  6.  $db PMO_MyBbms::factory($pdo);




Tags:

access:  public



Implementation of:
PMO_Dbms::factory()
The implementatio must create a PMO_MyDbms object or if it already exists, return a reference of this object instance

Parameters:

object   $object   a PDO object

[ Top ]

static method killInstance [line 166]

static void killInstance( )

kills the current PMO_Dbms object



Tags:

access:  public


[ Top ]

method delete [line 284]

bool delete( PMO_Object $object)

deletes the data row corresponding to the PMO_Object from the database table All primary key must be fill.



Tags:

return:  TRUE if the insert went PL
throws:  Exception if something went wrong
access:  public



Implementation of:
PMO_Dbms::delete()
the implementation must delete data corresponding to the PMO_Object in database All primary key must be fill.

Parameters:

object   $object   a PMO_Object corresponding to the target table

[ Top ]

method getDb [line 175]

PMO_Dbms|resource getDb( )

Returns the DB link or DB object



Tags:

return:  the PMO_MyDbms or database link resouRCE
access:  public


[ Top ]

method getLog [line 204]

array getLog( )

retrieves thee query verbose log



Tags:

access:  public


[ Top ]

method insert [line 348]

bool insert( PMO_Object $object)

inserts new data into the database table corresponding to the PMO_Object all primary keys must be fill.



Tags:

return:  TRUE if the insert went PL
throws:  Exception if something went wrong
access:  public



Implementation of:
PMO_Dbms::insert()
the implementation must insert new data in database corresponding to the PMO_Object all primary keys must be fill.

Parameters:

object   $object   a PMO_Object corresponding to the target table

[ Top ]

method load [line 254]

void load( PMO_Object $object)

Load a data row from the database and fills the PMO_Object with it

The data come from the first row of the fetchArray() method




Tags:

throws:  Exception
access:  public



Implementation of:
PMO_Dbms::load()
the implementation must load data from the database and fill the passed in PMO_Object with it

Parameters:

PMO_Object   $object  

[ Top ]

method setDb [line 184]

void setDb( object|resource $object)

Set the DB link or DB object



Tags:

access:  public


Parameters:

object|resource   $object   the PMO_MyDbms or database link resouRCE

[ Top ]

method setLog [line 194]

void setLog( string $log)

sets the query verbose log



Tags:

access:  public


Parameters:

string   $log   text to log

[ Top ]

method translateType [line 218]

string translateType( string $type)

converts the attribute types from database to PHP primary types: string, float, or int



Tags:

return:  a PHP data type
access:  protected


Parameters:

string   $type   the database type to convert

[ Top ]

method update [line 315]

bool update( PMO_Object $object)

updates the database table corresponding to the PMO_Object All primary keys must be fill.



Tags:

return:  TRUE if the insert went PL
throws:  Exception if something went wrong
access:  public



Implementation of:
PMO_Dbms::update()
the implementation must update the data corresponding to the PMO_Object in database All primary keys must be fill.

Parameters:

object   $object   a PMO_Object corresponding to the target table

[ Top ]


Documentation generated on Wed, 15 Oct 2008 09:17:11 -0400 by phpDocumentor 1.4.1