Login |  Register 
Get your website developed the easy way
Your open source Rocks PHP Library has really made developing PHP easier!
Alan
 

RocksDatabase Class

Description

This class enables easy database independent access to any database server.

  • property-read: string $username: the database user's username
  • property-read: string $password: the database user's password
  • property-read: string $hostname: the database host name
  • property-read: string $databaseName: the database name
  • property-read: string $databaseType: the database type so mysql, mssql etc
  • author: Dominic Skinner
  • version: 0.2.1

Located in /RocksDatabase.php (line 18)


	
			
Class Constant Summary
 DatabaseConfigName = "DatabaseName"
 DatabaseSectionName = "Database"
 DatabaseTypeConfigName = "DatabaseType"
 DebugConfigName = "Debug"
 HostnameConfigName = "Hostname"
 PasswordConfigName = "Password"
 UsernameConfigName = "Username"
Method Summary
RocksDatabase __construct ([string $configFileName = null])
int Execute (string $query)
array, GetTableFieldInfo (string $tableName)
void RegisterSQLErrorCallbackFunction (function $functionReference)
mixed Select (string $query, [string $fieldDefinition = null], [bool $alwaysReturnArray = false])
array SelectArray (string $query)
void __get ( $var)
Methods
Constructor __construct (line 68)

The constructor gives the database the $configFileName it will use.

  • access: public
RocksDatabase __construct ([string $configFileName = null])
  • string $configFileName: the configFileName to use if null use the one in the default location
Execute (line 425)

The Execute method executes the SQL and returns the last inserted id if it was a insert

  • return: the last inserted id if it was a insert
  • access: public
int Execute (string $query)
  • string $query: the SQL to execute
getLeftEscapeCharacter (line 144)
  • access: public
void getLeftEscapeCharacter ()
getRightEscapeCharacter (line 149)
  • access: public
void getRightEscapeCharacter ()
GetTableFieldInfo (line 331)

The GetTableFieldInfo method returns the field details for a given table.

  • return: this returns a array of field descriptions
  • access: public
array, GetTableFieldInfo (string $tableName)
  • string $tableName: the table name to return the fields for
RegisterSQLErrorCallbackFunction (line 360)

The RegisterSQLErrorCallbackFunction method calls the function it is passed on a SQL error so the developer can handle the error properly.

  • access: public
void RegisterSQLErrorCallbackFunction (function $functionReference)
  • function $functionReference: the function to call on a error
Select (line 385)

The Select method executes the SQL and returns either a single value or array

  • return: a array of either RocksDynamicClasses or RocksDBO objects. It will return RocksDBO objects if the select only used one table.
  • access: public
mixed Select (string $query, [string $fieldDefinition = null], [bool $alwaysReturnArray = false])
  • string $query: the SQL to execute
  • string $fieldDefinition: a field definition list, this is used internally usually.
  • bool $alwaysReturnArray: if true it will always return an array
SelectArray (line 371)

The SelectArray method executes the SQL and always returns a array of results

  • return: a array of either RocksDynamicClasses or RocksDBO objects
  • access: public
array SelectArray (string $query)
  • string $query: the SQL to execute
__get (line 166)
  • access: public
void __get ( $var)
  • $var
Class Constants
DatabaseConfigName = "DatabaseName" (line 54)

The database name configuration key used in the configuration file

DatabaseSectionName = "Database" (line 38)

The database section name used in the configuration file

DatabaseTypeConfigName = "DatabaseType" (line 58)

The datbase type configuration key used in the configuration file

DebugConfigName = "Debug" (line 62)

The debug configuration key used in the configuration file

HostnameConfigName = "Hostname" (line 50)

The host name configuration key used in the configuration file

PasswordConfigName = "Password" (line 46)

The password configuration key used in the configuration file

UsernameConfigName = "Username" (line 42)

The username configuration key used in the configuration file


No comments have been provided.
security image

Written by Dominic Skinner
Last Updated: 2009-09-22 17:51:45