Class CMS_query

Description

Class CMS_query

Launches query against the database. Connection information can be passed as parameter, or is taken from global constants. For now, only manages MySQL database.

Located in /automne/classes/common/query.php (line 31)

CMS_grandFather
   |
   --CMS_query
Variable Summary
 static array(PDO) $_connection
Method Summary
 static string echap (string $input)
 void __construct ([string $sql = ''], [string $dsn = APPLICATION_DB_DSN], [string $user = APPLICATION_DB_USER], [string $pass = APPLICATION_DB_PASSWORD])
 void executePreparedQuery (string $sql, array $params)
 array() getAll ([ $fetchMode = PDO::FETCH_BOTH], [ $column = 0])
 array(string=>mixed) getArray ([ $fetchMode = PDO::FETCH_BOTH])
 integer getLastInsertedID ()
 integer getNumRows ()
 mixed getValue (string $field)
 void _connect ( $dsn,  $user,  $pass, integer $id)
Variables
static array(PDO) $_connection (line 38)

All db connection in use

  • access: private
Methods
static echap (line 258)

Return an echapped input to use into an SQL query

  • return: echapped query
  • access: public
static string echap (string $input)
  • string $input: The string to echap
Constructor __construct (line 86)

Constructor.

Initializes the connection and launches the query.

  • access: public
void __construct ([string $sql = ''], [string $dsn = APPLICATION_DB_DSN], [string $user = APPLICATION_DB_USER], [string $pass = APPLICATION_DB_PASSWORD])
  • string $sql: The sql statement
  • string $dsn: The database dsn
  • string $user: The database user
  • string $pass: The database password
executePreparedQuery (line 138)

Execute prepared query Warning : this function is buggy when it used with serialised datas into an insert or an update statement Use it only for select.

  • access: private
void executePreparedQuery (string $sql, array $params)
  • string $sql: : the prepared query to execute
  • array $params: : the parameters for the query
getAll (line 212)

Get the all records as an associative array with fields names as keys.

  • access: public
array() getAll ([ $fetchMode = PDO::FETCH_BOTH], [ $column = 0])
  • $fetchMode
  • $column
getArray (line 202)

Get the next record as an associative array with fields names as keys.

  • access: public
array(string=>mixed) getArray ([ $fetchMode = PDO::FETCH_BOTH])
  • $fetchMode
getLastInsertedID (line 247)

Get the last inserted ID.

  • return: The last inserted ID.
  • access: public
integer getLastInsertedID ()
getNumRows (line 237)

Get the number of rows returned.

  • return: The number of rows affected
  • access: public
integer getNumRows ()
getValue (line 227)

Get the next record but only one field.

  • access: public
mixed getValue (string $field)
  • string $field: The field name we want the value of.
_connect (line 165)

Initiates connection with the database.

  • access: private
void _connect ( $dsn,  $user,  $pass, integer $id)
  • integer $id: DB id
  • $dsn
  • $user
  • $pass

Inherited Methods

Inherited From CMS_grandFather

 CMS_grandFather::autoload()
 CMS_grandFather::hasError()
 CMS_grandFather::log()
 CMS_grandFather::PHPErrorHandler()
 CMS_grandFather::raiseError()
 CMS_grandFather::setDebug()
 CMS_grandFather::setLog()
 CMS_grandFather::_raiseError()
 CMS_grandFather::__call()
Class Constants

Documentation generated on Wed, 15 Feb 2012 15:38:09 +0100 by phpDocumentor 1.4.3