diff --git a/inc/AwlDBDialect.php b/inc/AwlDBDialect.php index 8a1c62ae..5be6efd1 100644 --- a/inc/AwlDBDialect.php +++ b/inc/AwlDBDialect.php @@ -5,7 +5,7 @@ * This subpackage provides dialect specific support for PostgreSQL, and * may, over time, be extended to provide support for other SQL dialects. * -* See http://wiki.davical.org/w/Coding/PdoDatabase for design and usage information. +* See http://wiki.davical.org/w/Coding/AwlQuery for design and usage information. * * @package awl * @subpackage AwlDatabase @@ -18,7 +18,16 @@ if ( !defined('E_USER_ERROR') ) define('E_USER_ERROR',256); /** -* The AwlDBDialect class handles +* The AwlDBDialect class handles support for different SQL dialects +* +* This subpackage provides dialect specific support for PostgreSQL, and +* may, over time, be extended to provide support for other SQL dialects. +* +* If you are looking for the place to add support for other SQL dialects, +* this is the class that you should be looking at. You might also look at +* the AwlDatabase class which extends this one, but these are the core +* capabilities which most probably need attention. +* * @package awl */ class AwlDBDialect { diff --git a/inc/AwlDatabase.php b/inc/AwlDatabase.php index 7c1e6348..2f0eeec0 100644 --- a/inc/AwlDatabase.php +++ b/inc/AwlDatabase.php @@ -3,7 +3,7 @@ * AwlDatabase query/statement class and associated functions * * This subpackage provides some functions that are useful around database -* activity and a AwlDialect, AwlDatabase and AwlStatement classes to simplify +* activity and a AwlDBDialect, AwlDatabase and AwlStatement classes to simplify * handling of database queries and provide some access for a limited * ability to handle varying database dialects. * @@ -62,6 +62,11 @@ class AwlDatabase extends AwlDBDialect { */ protected $txnstate = 0; + /** + * Holds whether we are translating all statements. + */ + protected $translate_all = false; + /**#@-*/ /** @@ -70,6 +75,9 @@ class AwlDatabase extends AwlDBDialect { * @param array $driver_options PDO driver options to the prepare statement, commonly to do with cursors */ function prepare( $statement, $driver_options = array() ) { + if ( isset($this->translate_all) && $this->translate_all ) { + $statement = $this->TranslateSQL( $statement ); + } return $this->db->prepare( $statement, $driver_options ); } @@ -139,7 +147,9 @@ class AwlDatabase extends AwlDBDialect { * Operates identically to AwlDatabase::Prepare, except that $this->Translate() will be called on the query * before any processing. */ - function PrepareTranslated() { + function PrepareTranslated( $statement, $driver_options = array() ) { + $statement = $this->TranslateSQL( $statement ); + return $this->prepare( $statement, $driver_options ); } @@ -148,6 +158,8 @@ class AwlDatabase extends AwlDBDialect { * as if PrepareTranslated() had been called. */ function TranslateAll( $onoff_boolean ) { + $this->translate_all = $onoff_boolean; + return $onoff_boolean; } diff --git a/inc/AwlQuery.php b/inc/AwlQuery.php index c59122bf..0c9d216f 100644 --- a/inc/AwlQuery.php +++ b/inc/AwlQuery.php @@ -1,7 +1,7 @@ * @copyright Morphoss Ltd * @license http://gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/inc/AwlUpgrader.php b/inc/AwlUpgrader.php new file mode 100644 index 00000000..b5cf9584 --- /dev/null +++ b/inc/AwlUpgrader.php @@ -0,0 +1,39 @@ + +* @copyright Morphoss Ltd +* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LGPL version 3 or later +* @compatibility Requires PHP 5.1 or later +*/ + +require_once('AwlQuery.php'); + +/** +* Database upgrader class and associated functions +* +* This subpackage provides some functions that are useful around database +* schema creation and changes. +* +*/ + +/** +* The AwlUpgrader Class. +* +* This class updates an Awl database to a newer schema version. +* +* +* @package awl +*/ +class AwlUpgrader +{ + /** + * Constructor + * @return The AwlUpgrader object + */ + function __construct() { + return $this; + } +} +