Class OnpubDatabase

Description

Manage an Onpub database.

Located in /OnpubDatabase.php (line 13)


	
			
Method Summary
static string utf8Decode (string $in_str)
static void verifyExec (PDO $pdo, mixed $result, bool $isTransaction)
static void verifyExecute (PDO $pdo, mixed $result, bool $isTransaction, array $errorInfo)
static void verifyPrepare (PDO $pdo, mixed $result, bool $isTransaction)
static void verifyQuery (PDO $pdo, mixed $result, bool $isTransaction)
static void verifyTransaction (PDO $pdo, mixed $result)
OnpubDatabase __construct (PDO $pdo)
mixed current ()
mixed delete ()
mixed install ([int $version = NULL])
array listDBs ()
mixed status ()
Methods
static utf8Decode (line 524)

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 362)

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 $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 314)

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 $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 486)

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 $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 412)

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 $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 457)

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 $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 29)

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 $pdo)
current (line 41)

Get the name of the currently connected-to MySQL database.

  • return: NULL if no database is currently selected. Otherwise, the name of the MySQL that's currently being used.
  • access: public
mixed current ()
delete (line 64)

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 127)

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 ([int $version = NULL])
  • int $version: Optional argument to specify what version of the Onpub schema to install. If NULL (the default), the latest version of the schema will be added to the database.
listDBs (line 186)

Gets a list of MySQL databases that the logged-in user has access to.

System database names are excluded from the list.

  • return: Array will be empty if user has no database access. Otherwise array will contain the names of the MySQL databases she has access to.
  • access: public
array listDBs ()
status (line 215)

Check the status of the Onpub schema.

  • return: The version of the schema in the database as an int. An array of PDOException objects will be returned if the schema is incomplete or not installed.
  • access: public
mixed status ()

Documentation generated on Fri, 08 Feb 2013 04:02:20 -0500 by phpDocumentor 1.4.4