Public Member Functions | Data Fields
DataBaseMySql Class Reference

Database MySql connection. More...

Inheritance diagram for DataBaseMySql:
Dispersion Model

Public Member Functions

 DataBaseMySql ($db_connection)
 
 connection ()
 
 query ($query)
 
 execute ($query)
 
 nextObject ($result=null)
 
 numRows ($result=null)
 
 affectedRows ()
 
 queryOneRow ($query)
 
 lastId ()
 
 getQueriesCount ()
 
 resetRow ($result=null)
 
 close ()
 
- Public Member Functions inherited from Dispersion
 Dispersion ()
 
 emptyLayout ()
 
 set ($name, $value)
 
 _set ($name, $value)
 
 insertView ($name, $index=-1)
 

Data Fields

 $_connection = null
 
 $defaultDebug
 
 $nr_queries
 
 $last_result
 
 $sql_affected_rows
 
- Data Fields inherited from Dispersion
 $model_ob = null
 
 $debug_ob = null
 
 $_variables = array()
 
 $_content = array()
 
 $_content_count = 0
 
 $model
 
 $debug
 

Additional Inherited Members

- Protected Member Functions inherited from Dispersion
 requireConfigFile ($file_name, $required=false)
 

Detailed Description

Database MySql connection.

Version
1.1
Author
DinuSV

Executes mysql queries, offers query debugging and advanced query error management.

Member Function Documentation

DataBaseMySql (   $db_connection)

Constructor

Parameters
$db_connectionDatabaseConnection : Database connection
connection ( )
Returns
used database connection
query (   $query)

Query database

Parameters
string$query: query to send to the database
Returns
sqlresource $result
execute (   $query)

Execute query with no result return value

Parameters
string$query: query to execute
nextObject (   $result = null)

Returns the next object in the database

Parameters
sqlresource$result: optional, the last result will be used if none is added
Returns
object : the next row
numRows (   $result = null)

Get the number of rows

Parameters
sqlresource$result: optional, the last result will be used if none is added
Returns
numeric : number of rows
affectedRows ( )

Get the number of affected rows by the last query

Returns
numeric
queryOneRow (   $query)

Return unique result

Parameters
string$query: the query to fetch the object upon
Returns
object : the result as a row object
lastId ( )

Get the last inserted value's id

Returns
string/numeric
getQueriesCount ( )

Get number of queries executed on the database server

Returns
numeric : number of queries
resetRow (   $result = null)

Go back to the first element of the result line

Parameters
sqlresource$result
close ( )

Close connection to the database

Field Documentation

$_connection = null

resource : Connection to the mysql server

$defaultDebug

bool : Debug tables

$nr_queries

int : Total number of queries executed

$last_result

resource : Result of the last query executed

$sql_affected_rows

int : Affected rows of the last query executed