Jeff PHP framework  0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
DbManager Interface Reference

Database client interface. More...

+ Inheritance diagram for DbManager:

Public Member Functions

 __construct ($params)
 autoSelect ($fields, $tables, $where, $order=null, $limit=null)
 Executes a select statement on the active database, and returns the result.
 delete ($table, $where)
 Deletes records from the given table using the given where clause.
 escapeString ($string)
 Escapes the input string for safe database insertion.
 executeQuery ($query)
 Executes a query on the active database.
 getError ()
 Returns the error from the last executed function in a custom format.
 getFieldsName ($table)
 Returns the name of the fields of the given table.
 getNumRecords ($table, $where=null, $field='id')
 Returns the number of records in the given table selectyed by the given where clause.
 getTables ($like=null)
 Returns the names of the tables found in the connected database.
 getTableStructure ($table)
 Returns information about the structure of a table.
 insert ($table, $data)
 Inserts the given data in the given table.
 openConnection ()
 Opens the connection with the DB HOST, exits on error.
 queryResult ($query)
 Returns the query result with accessible data.
 update ($table, $data, $where)
 Updates the given table with the given data using the given where clause.

Detailed Description

Database client interface.

Defines a common interface for all db client classes.

Author:
abidibo abidi.nosp@m.bo@g.nosp@m.mail..nosp@m.com
Version:
0.99
Date:
2011-2012

Definition at line 25 of file interface.db.php.


Constructor & Destructor Documentation

DbManager::__construct ( params)

Implemented in mysql.


Member Function Documentation

DbManager::autoSelect ( fields,
tables,
where,
order = null,
limit = null 
)

Executes a select statement on the active database, and returns the result.

Parameters:
mixed$fieldsthe fields to be selected. Possible values: array of fields or string.
mixed$tablesthe table/s from which retrieve records. Possible values: array of tables, string.
string$wherethe where clause
string$orderthe order by clause
array$limitthe limit clause
Returns:
the associative array with the select statement result

Implemented in mysql.

DbManager::delete ( table,
where 
)

Deletes records from the given table using the given where clause.

Parameters:
string$tablethe database table
mixed$wherethe where clause
Returns:
boolean value: true on success, false on failure

Implemented in mysql.

DbManager::escapeString ( string)

Escapes the input string for safe database insertion.

Parameters:
string$string
Returns:
string the input string escaped

Implemented in mysql.

Executes a query on the active database.

Parameters:
string$querythe query to execute
Returns:
the query result as a resource or a bool value.

Implemented in mysql.

Returns the error from the last executed function in a custom format.

Returns:
associative array containing error information

Implemented in mysql.

Returns the name of the fields of the given table.

Parameters:
string$tablethe database table
Returns:
array containing the name of the fields

Implemented in mysql.

DbManager::getNumRecords ( table,
where = null,
field = 'id' 
)

Returns the number of records in the given table selectyed by the given where clause.

Parameters:
string$tablethe database table
mixed$wherethe where clause
string$fieldthe field used for counting
Returns:
number of records

Implemented in mysql.

DbManager::getTables ( like = null)

Returns the names of the tables found in the connected database.

Parameters:
string$likethe like clause, defaut null.
Returns:
array of table names

Implemented in mysql.

Returns information about the structure of a table.

Parameters:
string$tablethe database table
Returns:
information about the table structure.
The returned array is in the form
array("field_name" => array("property" => "value"), "primary_key" => "primary_key_name", "keys" => array("keyname1", "keyname2"))
Returned properties foreach field:
  • order: the ordinal position
  • deafult: the default value
  • null: whether the field is nullable or not
  • type: the field type (varchar, int, text, ...)
  • max_length: the field max length
  • n_int: the number of int digits
  • n_precision: the number of decimal digits
  • key: the field key if set
  • extra: extra information

Implemented in mysql.

DbManager::insert ( table,
data 
)

Inserts the given data in the given table.

Parameters:
string$tablethe database table
array$datathe data to insert in the form array('field_name'=>'value')
Returns:
the last inserted id on success, false on failure

Implemented in mysql.

Opens the connection with the DB HOST, exits on error.

Returns:
void

Implemented in mysql.

DbManager::queryResult ( query)

Returns the query result with accessible data.

Parameters:
string$querythe query to execute
Returns:
the query result

Implemented in mysql.

DbManager::update ( table,
data,
where 
)

Updates the given table with the given data using the given where clause.

Parameters:
string$table
array$datathe data to update in the form array('field_name'=>'value')
string$wherethe where clause
Returns:
boolean value: true on success, false on failure

Implemented in mysql.


The documentation for this interface was generated from the following file: