\myMVC_DatabaseConnector

Generic database connector.

It should not be used directly! Classes, derived from this, will be called from myMVC_BaseDB and derived to manage data in the database.

Summary

Methods
Properties
Constants
checkAutoIncrementalId()
checkSignedIntNotNull()
checkUnsignedIntNotNull()
checkSignedIntNull()
checkUnsignedIntNull()
checkSignedMediumIntNotNull()
checkUnsignedMediumIntNotNull()
checkSignedMediumIntNull()
checkUnsignedMediumIntNull()
checkSignedSmallIntNotNull()
checkUnsignedSmallIntNotNull()
checkSignedSmallIntNull()
checkUnsignedSmallIntNull()
checkSignedTinyIntNotNull()
checkUnsignedTinyIntNotNull()
checkSignedTinyIntNull()
checkUnsignedTinyIntNull()
checkBoolNotNull()
checkBoolNull()
checkString255NotNull()
checkString255Null()
checkTextNotNull()
checkTextNull()
checkEMailNotNull()
checkEMailNull()
checkURLNotNull()
checkURLNull()
checkDomainnameNotNull()
checkDomainnameNull()
checkDateNotNull()
checkDateNull()
checkTimeNotNull()
checkTimeNull()
checkDateTimeNotNull()
checkDateTimeNull()
checkIPNotNull()
checkIPNull()
checkMacNotNull()
checkMacNull()
checkNetworkNotNull()
checkNetworkNull()
checkMaskNotNull()
checkMaskNull()
No public properties found
No constants found
__construct()
errno()
error()
getDatabaseConnection()
quoteSqlString()
quoteSqlStringForLike()
execute()
executeSelect()
getValueArrayFromResult()
getValuesFromResult()
getRowsNum()
freeResult()
$server
$login
$password
$database
$engine
N/A
No private methods found
No private properties found
N/A

Properties

$server

$server : 

Type

$login

$login : 

Type

$password

$password : 

Type

$database

$database : 

Type

$engine

$engine : 

Type

Methods

checkAutoIncrementalId()

checkAutoIncrementalId(  $value,   $type) 

Check function for typical autoincrement ID (INT(11) NOT NULL)

Parameters

$value
$type

checkSignedIntNotNull()

checkSignedIntNotNull(  $value,   $type) 

Check function for Signed INT NOT NULL

Parameters

$value
$type

checkUnsignedIntNotNull()

checkUnsignedIntNotNull(  $value,   $type) 

Check function for Unsigned INT NOT NULL

Parameters

$value
$type

checkSignedIntNull()

checkSignedIntNull(  $value,   $type) 

Check function for Signed INT NULL

Parameters

$value
$type

checkUnsignedIntNull()

checkUnsignedIntNull(  $value,   $type) 

Check function for Unsigned INT NULL

Parameters

$value
$type

checkSignedMediumIntNotNull()

checkSignedMediumIntNotNull(  $value,   $type) 

Check function for Signed MEDIUMINT NOT NULL

Parameters

$value
$type

checkUnsignedMediumIntNotNull()

checkUnsignedMediumIntNotNull(  $value,   $type) 

Check function for Unsigned MEDIUMINT NOT NULL

Parameters

$value
$type

checkSignedMediumIntNull()

checkSignedMediumIntNull(  $value,   $type) 

Check function for Signed MEDIUMINT NULL

Parameters

$value
$type

checkUnsignedMediumIntNull()

checkUnsignedMediumIntNull(  $value,   $type) 

Check function for Unsigned MEDIUMINT NULL

Parameters

$value
$type

checkSignedSmallIntNotNull()

checkSignedSmallIntNotNull(  $value,   $type) 

Check function for Signed SMALLINT NOT NULL

Parameters

$value
$type

checkUnsignedSmallIntNotNull()

checkUnsignedSmallIntNotNull(  $value,   $type) 

Check function for Unsigned SMALLINT NOT NULL

Parameters

$value
$type

checkSignedSmallIntNull()

checkSignedSmallIntNull(  $value,   $type) 

Check function for Signed SMALLINT NULL

Parameters

$value
$type

checkUnsignedSmallIntNull()

checkUnsignedSmallIntNull(  $value,   $type) 

Check function for Unsigned SMALLINT NULL

Parameters

$value
$type

checkSignedTinyIntNotNull()

checkSignedTinyIntNotNull(  $value,   $type) 

Check function for Signed TINYINT NOT NULL

Parameters

$value
$type

checkUnsignedTinyIntNotNull()

checkUnsignedTinyIntNotNull(  $value,   $type) 

Check function for Unsigned TINYINT NOT NULL

Parameters

$value
$type

checkSignedTinyIntNull()

checkSignedTinyIntNull(  $value,   $type) 

Check function for Signed TINYINT NULL

Parameters

$value
$type

checkUnsignedTinyIntNull()

checkUnsignedTinyIntNull(  $value,   $type) 

Check function for Unsigned TINYINT NULL

Parameters

$value
$type

checkBoolNotNull()

checkBoolNotNull(  $value,   $type) 

Check function for boolean value NOT NULL

Parameters

$value
$type

checkBoolNull()

checkBoolNull(  $value,   $type) 

Check function for boolean value NULL

Parameters

$value
$type

checkString255NotNull()

checkString255NotNull(  $value,   $type) 

Check function for VARCHAR(255) NOT NULL

Parameters

$value
$type

checkString255Null()

checkString255Null(  $value,   $type) 

Check function for VARCHAR(255) NULL

Parameters

$value
$type

checkTextNotNull()

checkTextNotNull(  $value,   $type) 

Check function for TEXT NOT NULL

Parameters

$value
$type

checkTextNull()

checkTextNull(  $value,   $type) 

Check function for TEXT NULL

Parameters

$value
$type

checkEMailNotNull()

checkEMailNotNull(  $value,   $type) 

Check function for E-Mail address NOT NULL

Parameters

$value
$type

checkEMailNull()

checkEMailNull(  $value,   $type) 

Check function for E-Mail address NULL

Parameters

$value
$type

checkURLNotNull()

checkURLNotNull(  $value,   $type) 

Check function for URL NOT NULL

Parameters

$value
$type

checkURLNull()

checkURLNull(  $value,   $type) 

Check function for URL NULL

Parameters

$value
$type

checkDomainnameNotNull()

checkDomainnameNotNull(  $value,   $type) 

Check function for domain name NOT NULL

Parameters

$value
$type

checkDomainnameNull()

checkDomainnameNull(  $value,   $type) 

Check function for domain name NULL

Parameters

$value
$type

checkDateNotNull()

checkDateNotNull(  $value,   $type) 

Check function for date NOT NULL (Format: YYYY-MM-DD)

Parameters

$value
$type

checkDateNull()

checkDateNull(  $value,   $type) 

Check function for date NULL (Format: YYYY-MM-DD)

Parameters

$value
$type

checkTimeNotNull()

checkTimeNotNull(  $value,   $type) 

Check function for time NOT NULL (Format: HH:MM:SS)

Parameters

$value
$type

checkTimeNull()

checkTimeNull(  $value,   $type) 

Check function for time NULL (Format: HH:MM:SS)

Parameters

$value
$type

checkDateTimeNotNull()

checkDateTimeNotNull(  $value,   $type) 

Check function for date NOT NULL (Format: YYYY-MM-DD HH:MM:SS)

Parameters

$value
$type

checkDateTimeNull()

checkDateTimeNull(  $value,   $type) 

Check function for date NULL (Format: YYYY-MM-DD HH:MM:SS)

Parameters

$value
$type

checkIPNotNull()

checkIPNotNull(  $value,   $type) 

Check function for IPv4 addresses (NOT NULL)

Parameters

$value
$type

checkIPNull()

checkIPNull(  $value,   $type) 

Check function for IPv4 addresses (NULL)

Parameters

$value
$type

checkMacNotNull()

checkMacNotNull(  $value,   $type) 

Check function for MAC addresses (NOT NULL)

Parameters

$value
$type

checkMacNull()

checkMacNull(  $value,   $type) 

Check function for MAC addresses (NULL)

Parameters

$value
$type

checkNetworkNotNull()

checkNetworkNotNull(  $value,   $type) 

Check function for IPv4 network (NOT NULL)

Parameters

$value
$type

checkNetworkNull()

checkNetworkNull(  $value,   $type) 

Check function for IPv4 network (NULL)

Parameters

$value
$type

checkMaskNotNull()

checkMaskNotNull(  $value,   $type) 

Check function for IPv4 netmask (NOT NULL)

Parameters

$value
$type

checkMaskNull()

checkMaskNull(  $value,   $type) 

Check function for IPv4 netmask (NULL)

Parameters

$value
$type

__construct()

__construct() 

Constructor. Initializes the database connection WARNING: This function will only called from myMVC_BaseDB constructor, using the proper derived class (see: myMVC_DatabaseConnectorMysql and myMVC_DatabaseConnectorPgsql)

errno()

errno() : integer

Wrapper for the errno-function of the selected database engine

Returns

integer —

the error number

error()

error() : string

Wrapper for the error-function of the selected database engine

Returns

string —

the error string

getDatabaseConnection()

getDatabaseConnection() : resource

Connects to the database.

This will just be done, if no connection exists yet.

Throws

\myMVC_DatabaseException

if no connection is possible

Returns

resource —

a connection resource

quoteSqlString()

quoteSqlString(string  $value) : string

Quotes a string to use in a SQL-Query

Parameters

string $value

The string with the Query

Returns

string —

A secure SQL-String (quoted)

quoteSqlStringForLike()

quoteSqlStringForLike(string  $value, string  $prefix = '%', string  $suffix = '%') : string

Quotes a string to use in a SQL-Query (with LIKE)

Parameters

string $value

The string with the Query

string $prefix

(normally %) added BEFORE the string

string $suffix

(normally %) added AFTER the string

Returns

string —

A secure SQL-String (quoted)

execute()

execute(string  $query) : boolean

Execute an INSERT, UPDATE or DELETE query

Parameters

string $query

The SQL-Query

Returns

boolean —

true on success, false on failure, last inserted ID on successfully INSERT

executeSelect()

executeSelect(string  $query) : resource

Executes a SELECT-Query

Parameters

string $query

The SQL-Query

Returns

resource —

a resource to get data on success, false otherwise

getValueArrayFromResult()

getValueArrayFromResult(resource  $result) : array

Returns a record as associative array, or NULL if no record can be returned.

Parameters

resource $result

The resource

Returns

array —

The record

getValuesFromResult()

getValuesFromResult(resource  $result) : array

Returns a record as numeric array, or NULL if no record can be returned.

Parameters

resource $result

The resource

Returns

array —

The record

getRowsNum()

getRowsNum(resource  $result) : integer

Returns the number of row of the runned query.

Parameters

resource $result

The resource

Returns

integer —

The row's number

freeResult()

freeResult(resource  $result) : boolean

Free the allocated memory for the SQL query.

Parameters

resource $result

The resource

Returns

boolean —

true on success, false on problem