Phpfox_Database_Support

Description

Works with all the supported database drivers we support and what the actual

server can handle as well. It can also perform certain tasks on all the database drivers without the need to seperate the command. This is mainly used during and install or upgrade or our product to find the supported database drivers and perform and modifications on the queries based on the driver being used.

  • author: Raymond Benc
  • version: $Id: support.class.php 1687 2010-07-22 03:13:27Z Raymond_Benc $
  • copyright: [PHPFOX_COPYRIGHT]

Located in /include/library/phpfox/database/support.class.php (line 20)


	
			
Variable Summary
 array $_aDbs
Method Summary
 Phpfox_Database_Support __construct ()
 array getColumns (string $sTable, [string $sDriver = null], [ &$oDb = null], mixed $oDb)
 mixed getDriver (string $sLabel)
 array getIndexes (string $sTable, [string $sDriver = null], [ &$oDb = null], mixed $oDb)
 array getSchema (string $sName, [string $sPrefix = null])
 array getSupported ([bool $bReturnAll = false])
 array getTables ([string $sDriver = null], [ &$oDb = null], mixed $oDb)
 array prepareSchema ([array $aTables = array()], [ &$oDb = null], mixed $oDb)
 void removeComments ( &$sContent, string $sContent)
 void removeRemarks ( &$sContent, string $sContent)
 array splitSqlFile (string $sql, string $delimiter)
Variables
array $_aDbs = array(
'mysql' => array(
'label' => 'MySQL',
'schema' => 'mysql',
'module' => 'mysql',
'delim' => ';',
'comments' => 'remove_remarks',
'driver' => 'mysql',
'available' => true
),'mysqli'=>array('label'=>'MySQL with MySQLi Extension','schema'=>'mysql','module'=>'mysqli','delim'=>';','comments'=>'remove_remarks','driver'=>'mysqli','available'=>true),'mssql'=>array('label'=>'MS SQL Server 2000+','schema'=>'mssql','module'=>'mssql','delim'=>'GO','comments'=>'remove_comments','driver'=>'mssql','available'=>false),'postgres'=>array('label'=>'PostgreSQL 7.x/8.x','schema'=>'postgres','module'=>'pgsql','delim'=>';','comments'=>'remove_comments','driver'=>'postgres','available'=>false),'sqlite'=>array('label'=>'SQLite','schema'=>'sqlite','module'=>'sqlite','delim'=>';','comments'=>'remove_remarks','driver'=>'sqlite','available'=>false),'oracle'=>array('label'=>'Oracle','schema'=>'oracle','module'=>'oci8','delim'=>'/','comments'=>'remove_comments','driver'=>'oracle','available'=>false),)
(line 27)

Array of all the drivers we are testing but also the ones we just support at the moment.

  • access: private
Methods
Constructor __construct (line 88)

Class constructor

  • access: public
Phpfox_Database_Support __construct ()
getColumns (line 249)

Gets all the columns for a specific database table.

  • return: Returns an array of columns from a specific table.
  • access: public
array getColumns (string $sTable, [string $sDriver = null], [ &$oDb = null], mixed $oDb)
  • string $sTable: Database table to work with
  • string $sDriver: Optional command to identify what SQL driver we are working with
  • mixed $oDb: This can be an object or resource based on the SQL driver being used.
  • &$oDb
getDriver (line 128)

Gets a specific driver and returns all the information about it.

  • return: Array if we can find the driver or FALSE if we cannot.
  • access: public
mixed getDriver (string $sLabel)
  • string $sLabel: Drivers name
getIndexes (line 287)

Gets all the indexes for a specific database table.

  • return: Returns an array of indexes from a specific table.
  • access: public
array getIndexes (string $sTable, [string $sDriver = null], [ &$oDb = null], mixed $oDb)
  • string $sTable: Database table to work with
  • string $sDriver: Optional command to identify what SQL driver we are working with
  • mixed $oDb: This can be an object or resource based on the SQL driver being used.
  • &$oDb
getSchema (line 141)

Returns an SQL schema for a specific driver. Only used in development mode when exporting our database before a release.

  • return: Array of SQL logic we transformed from the SQL schema which is a string of information
  • access: public
array getSchema (string $sName, [string $sPrefix = null])
  • string $sName: Name of the SQL driver
  • string $sPrefix: Optional string for the prefix of the table names
getSupported (line 99)

Gets all the supported drivers by making sure the driver class exists and if the actual server has support for it.

  • return: Array of database drivers the server can handle
  • access: public
array getSupported ([bool $bReturnAll = false])
  • bool $bReturnAll: If set to TRUE it will return all the drivers even if they are not supported by the server.
getTables (line 324)

Gets all the tables from the database.

  • return: Returns an array of all the tables.
  • access: public
array getTables ([string $sDriver = null], [ &$oDb = null], mixed $oDb)
  • string $sDriver: Optional command to identify what SQL driver we are working with
  • mixed $oDb: This can be an object or resource based on the SQL driver being used.
  • &$oDb
prepareSchema (line 428)

Prepares SQL code to be transformed into PHP logic to later be used during an upgrade of the script.

  • return: Returns an array of PHP logic to store and use at a later time.
  • access: public
array prepareSchema ([array $aTables = array()], [ &$oDb = null], mixed $oDb)
  • array $aTables: Array of tables to export.
  • mixed $oDb: This can be an object or resource based on the SQL driver being used.
  • &$oDb
removeComments (line 213)

Remove any SQL comments from the output

  • access: public
void removeComments ( &$sContent, string $sContent)
  • string $sContent: SQL code to parse and remove comments from
  • &$sContent
removeRemarks (line 203)

Remove any SQL remarks from the output

  • access: public
void removeRemarks ( &$sContent, string $sContent)
  • string $sContent: SQL code to parse and remove remarks from
  • &$sContent
splitSqlFile (line 180)

Split an SQL schema or string based on the delimiter used by the specific database driver.

  • return: Array of SQL lines of the string schema
  • access: public
array splitSqlFile (string $sql, string $delimiter)
  • string $sql: SQL code to parse
  • string $delimiter: Delimiter used to split the SQL code

Documentation generated on Tue, 28 Sep 2010 10:36:44 +0200 by phpDocumentor 1.4.0a2