Class OnpubDatabase

Description

Manage an Onpub database.

Located in /OnpubDatabase.php (line 14)


	
			
Class Constant Summary
 MYSQL_TABLES_CREATE_FILE = 'api/sql/create_onpub_mysql_tables.sql'
 MYSQL_TABLES_DELETE_FILE = 'api/sql/delete_onpub_mysql_tables.sql'
Method Summary
static string utf8Decode (string $in_str)
static void verifyExec ( $pdo, mixed $result, bool $isTransaction)
static void verifyExecute ( $pdo, mixed $result, bool $isTransaction, array $errorInfo)
static void verifyPrepare ( $pdo, mixed $result, bool $isTransaction)
static void verifyQuery ( $pdo, mixed $result, bool $isTransaction)
static void verifyTransaction ( $pdo, mixed $result)
OnpubDatabase __construct ( $pdo)
mixed delete ()
mixed install ()
mixed status ()
Methods
static utf8Decode (line 436)

Decode a UTF8-encoded string to a latin1-encoded string.

  • return: latin1-encoded string.
  • access: public
static string utf8Decode (string $in_str)
  • string $in_str: UTF8-encoded string.
static verifyExec (line 284)

Verify the results of a call to PDO->exec().

Used internally to verify whether or not a PDO->exec() call was successful or not. If the call returned FALSE then an exception is thrown with an error message and error code, explaining what went wrong. If the exec() call fails during a running database transaction, PDO->rollback() is called to roll back the transaction to put the database back in the state it was before the error occured; then the appropriate exception is thrown.

  • throws: PDOException if the exec() call failed.
  • access: public
static void verifyExec ( $pdo, mixed $result, bool $isTransaction)
  • PDO $pdo: The PDO object which called exec().
  • mixed $result: The value exec() returned when it was called.
  • bool $isTransaction: TRUE if exec() was called during a running database transaction, FALSE otherwise.
static verifyExecute (line 239)

Verify the results of a call to PDOStatement->execute().

Used internally to verify whether or not a PDOStatement->execute() call was successful or not. If the call returned FALSE then an exception is thrown with an error message and error code, explaining what went wrong. If the execute() call fails during a running database transaction, PDOStatement->rollback() is called to roll back the transaction to put the database back in the state it was before the error occured; then the appropriate exception is thrown.

  • throws: PDOException if the execute() call failed.
  • access: public
static void verifyExecute ( $pdo, mixed $result, bool $isTransaction, array $errorInfo)
  • PDO $pdo: The PDO object which called prepare().
  • mixed $result: The value execute() returned when it was called.
  • bool $isTransaction: TRUE if execute() was called during a running database transaction, FALSE otherwise.
  • array $errorInfo: The array returned by PDOStatement->errorInfo().
static verifyPrepare (line 401)

Verify the results of a call to PDO->prepare().

Used internally to verify whether or not a PDO->prepare() call was successful or not. If the call returned FALSE then an exception is thrown with an error message and error code, explaining what went wrong. If the prepare() call fails during a running database transaction, PDO->rollback() is called to roll back the transaction to put the database back in the state it was before the error occured; then the appropriate exception is thrown.

  • throws: PDOException if the prepare() call failed.
  • access: public
static void verifyPrepare ( $pdo, mixed $result, bool $isTransaction)
  • PDO $pdo: The PDO object which called prepare().
  • mixed $result: The value prepare() returned when it was called.
  • bool $isTransaction: TRUE if prepare() was called during a running database transaction, FALSE otherwise.
static verifyQuery (line 331)

Verify the results of a call to PDO->query().

Used internally to verify whether or not a PDO->query() call was successful or not. If the call returned FALSE then an exception is thrown with an error message and error code, explaining what went wrong. If the query() call fails during a running database transaction, PDO->rollback() is called to roll back the transaction to put the database back in the state it was before the error occured; then the appropriate exception is thrown.

  • throws: PDOException if the query() call failed.
  • access: public
static void verifyQuery ( $pdo, mixed $result, bool $isTransaction)
  • PDO $pdo: The PDO object which called query().
  • mixed $result: The value query() returned when it was called.
  • bool $isTransaction: TRUE if query() was called during a running database transaction, FALSE otherwise.
static verifyTransaction (line 373)

Verify the results of a call to PDO->beginTransaction() or PDO->commit().

Used internally to verify whether or not a PDO->beginTransaction() or a PDO->rollback() call was successful or not. If the call returned FALSE then an exception is thrown with an error message and error code, explaining what went wrong.

  • throws: PDOException if the beginTransaction() or rollback() call failed.
  • access: public
static void verifyTransaction ( $pdo, mixed $result)
  • PDO $pdo: The PDO object which called beginTransaction() or rollback().
  • mixed $result: The value beginTransaction() or rollback() returned when it was called.
Constructor __construct (line 32)

Connect to a database.

All the methods in this class which query the database use the database connection provided by the PDO object required by this constructor. Currently, Onpub only supports MySQL as a database for storing content. Therefore, when constructing the PDO object, only the PDO_MYSQL driver is supported as a PDO data source.

OnpubDatabase __construct ( $pdo)
delete (line 47)

Delete the Onpub schema.

Calling this method will delete all Onpub content and schema in the PDO-connected database! Use with caution.

  • return: TRUE if the schema was successfully deleted. An array of PDOException objects will be returned if any errors occured.
  • access: public
mixed delete ()
install (line 110)

Install the Onpub schema.

Calling this method will install the Onpub tables in the PDO-connected database.

  • return: TRUE if the schema was successfully installed. An array of PDOException objects will be returned if any errors occured.
  • access: public
mixed install ()
status (line 171)

Check the status of the Onpub schema.

  • return: TRUE if the schema is properly installed. An array of PDOException objects will be returned if the schema is incomplete or not installed.
  • access: public
mixed status ()
Class Constants
MYSQL_TABLES_CREATE_FILE = 'api/sql/create_onpub_mysql_tables.sql' (line 16)
MYSQL_TABLES_DELETE_FILE = 'api/sql/delete_onpub_mysql_tables.sql' (line 17)

Documentation generated on Sat, 20 Sep 2008 19:13:16 -0400 by phpDocumentor 1.4.2