Class myMVC_DatabaseConnector

Description

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.

Located in /myMVC/DatabaseConnector.php (line 29)

myMVC_TypeCheck
   |
   --myMVC_DatabaseConnector
Direct descendents
Class Description
 class myMVC_DatabaseConnectorPgsql Database connector for PostgreSQL (http://www.postgresql.org/)
 class myMVC_DatabaseConnectorMysql Database connector for MySQL (http://www.mysql.com/)
 class myMVC_BaseDB Base class for a database table's class Every table must have a derived class with the check function Example:
Variable Summary
 mixed $database
 mixed $engine
 mixed $login
 mixed $password
 mixed $server
Method Summary
 myMVC_DatabaseConnector __construct ()
 int errno ()
 string error ()
 boolean execute (string $query)
 resource executeSelect (string $query)
 boolean freeResult (resource $result)
 resource getDatabaseConnection ()
 int getRowsNum (resource $result)
 array getValueArrayFromResult (resource $result)
 array getValuesFromResult (resource $result)
 string quoteSqlString (string $value)
 string quoteSqlStringForLike (string $value, [string $prefix = '%'], [string $suffix = '%'])
Variables
mixed $database (line 34)
  • access: protected
mixed $engine (line 35)
  • access: protected

Redefined in descendants as:
mixed $login (line 32)
  • access: protected
mixed $password (line 33)
  • access: protected
mixed $server (line 31)
  • access: protected
Methods
Constructor __construct (line 43)

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)

  • access: protected
myMVC_DatabaseConnector __construct ()

Redefined in descendants as:
errno (line 59)

Wrapper for the errno-function of the selected database engine

  • return: the error number
  • access: protected
int errno ()

Redefined in descendants as:
error (line 69)

Wrapper for the error-function of the selected database engine

  • return: the error string
  • access: protected
string error ()

Redefined in descendants as:
execute (line 117)

Execute an INSERT, UPDATE or DELETE query

  • return: true on success, false on failure, last inserted ID on successfully INSERT
  • access: protected
boolean execute (string $query)
  • string $query: The SQL-Query

Redefined in descendants as:
executeSelect (line 128)

Executes a SELECT-Query

  • return: a resource to get data on success, false otherwise
  • access: protected
resource executeSelect (string $query)
  • string $query: The SQL-Query

Redefined in descendants as:
freeResult (line 172)

Free the allocated memory for the SQL query.

  • return: true on success, false on problem
  • access: protected
boolean freeResult (resource $result)
  • resource $result: The resource

Redefined in descendants as:
getDatabaseConnection (line 81)

Connects to the database.

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

  • return: a connection resource
  • throws: myMVC_DatabaseException if no connection is possible
  • access: protected
resource getDatabaseConnection ()

Redefined in descendants as:
getRowsNum (line 161)

Returns the number of row of the runned query.

  • return: The row's number
  • access: protected
int getRowsNum (resource $result)
  • resource $result: The resource

Redefined in descendants as:
getValueArrayFromResult (line 139)

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

  • return: The record
  • access: protected
array getValueArrayFromResult (resource $result)
  • resource $result: The resource

Redefined in descendants as:
getValuesFromResult (line 150)

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

  • return: The record
  • access: protected
array getValuesFromResult (resource $result)
  • resource $result: The resource

Redefined in descendants as:
quoteSqlString (line 93)

Quotes a string to use in a SQL-Query

  • return: A secure SQL-String (quoted)
  • access: protected
string quoteSqlString (string $value)
  • string $value: The string with the Query
quoteSqlStringForLike (line 106)

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

  • return: A secure SQL-String (quoted)
  • access: protected
string quoteSqlStringForLike (string $value, [string $prefix = '%'], [string $suffix = '%'])
  • string $value: The string with the Query
  • string $prefix: (normally %) added BEFORE the string
  • string $suffix: (normally %) added AFTER the string

Redefined in descendants as:

Inherited Methods

Inherited From myMVC_TypeCheck

 myMVC_TypeCheck::checkAutoIncrementalId()
 myMVC_TypeCheck::checkBoolNotNull()
 myMVC_TypeCheck::checkBoolNull()
 myMVC_TypeCheck::checkDateNotNull()
 myMVC_TypeCheck::checkDateNull()
 myMVC_TypeCheck::checkDateTimeNotNull()
 myMVC_TypeCheck::checkDateTimeNull()
 myMVC_TypeCheck::checkDomainnameNotNull()
 myMVC_TypeCheck::checkDomainnameNull()
 myMVC_TypeCheck::checkEMailNotNull()
 myMVC_TypeCheck::checkEMailNull()
 myMVC_TypeCheck::checkIPNotNull()
 myMVC_TypeCheck::checkIPNull()
 myMVC_TypeCheck::checkMacNotNull()
 myMVC_TypeCheck::checkMacNull()
 myMVC_TypeCheck::checkMaskNotNull()
 myMVC_TypeCheck::checkMaskNull()
 myMVC_TypeCheck::checkNetworkNotNull()
 myMVC_TypeCheck::checkNetworkNull()
 myMVC_TypeCheck::checkSignedIntNotNull()
 myMVC_TypeCheck::checkSignedIntNull()
 myMVC_TypeCheck::checkSignedMediumIntNotNull()
 myMVC_TypeCheck::checkSignedMediumIntNull()
 myMVC_TypeCheck::checkSignedSmallIntNotNull()
 myMVC_TypeCheck::checkSignedSmallIntNull()
 myMVC_TypeCheck::checkSignedTinyIntNotNull()
 myMVC_TypeCheck::checkSignedTinyIntNull()
 myMVC_TypeCheck::checkString255NotNull()
 myMVC_TypeCheck::checkString255Null()
 myMVC_TypeCheck::checkTextNotNull()
 myMVC_TypeCheck::checkTextNull()
 myMVC_TypeCheck::checkTimeNotNull()
 myMVC_TypeCheck::checkTimeNull()
 myMVC_TypeCheck::checkUnsignedIntNotNull()
 myMVC_TypeCheck::checkUnsignedIntNull()
 myMVC_TypeCheck::checkUnsignedMediumIntNotNull()
 myMVC_TypeCheck::checkUnsignedMediumIntNull()
 myMVC_TypeCheck::checkUnsignedSmallIntNotNull()
 myMVC_TypeCheck::checkUnsignedSmallIntNull()
 myMVC_TypeCheck::checkUnsignedTinyIntNotNull()
 myMVC_TypeCheck::checkUnsignedTinyIntNull()
 myMVC_TypeCheck::checkURLNotNull()
 myMVC_TypeCheck::checkURLNull()

Documentation generated on Thu, 05 Jan 2017 12:47:14 +0100 by phpDocumentor 1.4.4