User Tools

Site Tools


Sidebar

Dokumentation

vortex:apidoc:dbhandler

DBHandler

DBHandler

Filename : classes/*handler.php
Extends :

Description

The class handing all the database connectivity for the Vortex. Several handlers exists, mysqlhandler and mysqlihandler being the default ones. Handlers can be added dynamically and which handler is used is specified in the config file for the DBI.

Fields

MASKLOG

Definition : const MASKLOG = 0x02
Description
Mask the logged event if it is a password, this is the default logging mode

NOLOG

Definition : const NOLOG = 0x01
Description
No logging running mode

NORMAL

Definition : const NORMAL = 0x00
Description
Constant defining normal running mode

Methods

__construct( $user, $pass, $database, $host )

Definition : public function __construct( $user, $pass, $database, $host=string">'localhost')

Returns :

Description
Instantiate the DBHandler

Parameters

$database

Type : String
Default value :

Description
Name of the database to connect to

$host

Type : String
Default value : localhost

Description
Name of the host to connect to

$pass

Type : String
Default value :

Description
Password of the database user

$user

Type : String
Default value :

Description
Username of the database user

affected_rows()

Definition : public function affected_rows()

Returns : int

Description
Get the number of rows affected by the last statement

Parameters

appendXML( $XML, $prefix )

Definition : public function appendXML( $XML, $prefix = string">"customxml" )

Returns :

Description
Appends the given XML document to the defined XML commands in this handler

Parameters

$prefix

Type : String
Default value : customxml

Description
Prefix to add to the appended commands, making sure they do not overlap existing commands

$XML

Type : DOMDocument
Default value :

Description
DOMDocument containing XML DB-commands to append

connect()

Definition : public function connect()

Returns : boolean - false on error, otherwise true

Description
Connects to the database

Parameters

disconnect()

Definition : public function disconnect()

Returns :

Description
Disconnects from the database

Parameters

escapeString( $str )

Definition : public function escapeString( $str )

Returns : String

Description
Returns the escaped string for use in a query

Parameters

$str

Type : String
Default value :

Description
String to escape

fetchArray( $result )

Definition : public function fetchArray( $result )

Returns : Array

Description
Fetches a row from the supplied resultset as an associative array

Parameters

$result

Type : Reference
Default value :

Description
Resultset to fetch row from

fetchRow( $result )

Definition : public function fetchRow( $result )

Returns : Array

Description
Fetches a row from the supplied resultset

Parameters

$result

Type : Reference
Default value :

Description
Resultset to fetch row from

freeresult( $result )

Definition : public function freeresult( $result )

Returns :

Description
Frees the supplied resultset

Parameters

$result

Type : Reference
Default value :

Description
Resultset to free

getArray()

Definition : public function getArray()

Returns : Array or false on error

Description
Takes the same parameters as the query method. Executes the given query and returns the first row as an associative array, freeing the result.

Parameters

getRow()

Definition : public function getRow()

Returns : Array or false on error

Description
Takes the same parameters as the query method. Executes the given query and returns the first row as an array, freeing the result.

Parameters

getXML()

Definition : public function getXML()

Returns : DOMDocument

Description
Get the set of XML-commands defined in this handler

Parameters

insert_id()

Definition : public function insert_id()

Returns : int

Description
Get the numerical ID of the last INSERT statement

Parameters

num_rows( $result )

Definition : public function num_rows( $result )

Returns : int

Description
Get the number of rows matched in the supplied resultset

Parameters

$result

Type : Reference
Default value :

Description
Resultset to get number of rows from

parseQuery()

Definition : public function parseQuery()

Returns : String

Description
Get the parsed query using all the applicable rules for this handler

Parameters

query()

Definition : public function query()

Returns : Result Reference

Description
Given a parameter set on the printf format this method will parse and execute the given query.

Parameters

Unnamed

Type : *
Default value :

Description
Parameter list on the printf format containing the SQL Query to execute.
IE $dbh->query( "SELECT %s FROM %s", $field, $table )

setLogMode( $newMode )

Definition : public function setLogMode( $newMode )

Returns :

Description
Sets the logging mode for this handler.

Parameters

$newMode

Type : int
Default value :

Description
One of the loggingmode constants defined in this class

setXML( &$XML )

Definition : public function setXML( &$XML )

Returns :

Description
Set the initial commandset

Parameters

$XML

Type : DOMDocument
Default value :

Description
DOMDocument comtaining XML DB-commands to use

trans_autocommit( $enabled )

Definition : public function trans_autocommit( $enabled = true )

Returns :

Description
Set the autocommit status

Parameters

$enabled

Type : boolean
Default value : true

Description
Whether to enable or disable the autocommit feature

trans_begin()

Definition : public function trans_begin()

Returns :

Description
Begin a transaction, disabling autocommit

Parameters

trans_commit()

Definition : public function trans_commit()

Returns :

Description
Commit a transaction, reenable autocommit

Parameters

trans_rollback()

Definition : public function trans_rollback()

Returns :

Description
Rollback a transaction, reenable autocommit

Parameters

vortex/apidoc/dbhandler.txt · Last modified: 2019/06/28 07:06 by hubbe