Class Sylar_MysqlDriver

Description

Implements interfaces:

Connessione MySQL.

Esegue la connessione ad un database, in questo caso specifico MySQL. Permette di connettersi direttamente al DB predefinito se non vengono specificati parametri diversi.

Located in /sylar/classes/common/db/mysql/MysqlDriver.php (line 45)


	
			
Direct descendents
Class Description
 class Sylar_SqlLogger Sql layer for Logger
 class Sylar_BindSimpleTable Bind SimpleTable to DBTable
Variable Summary
 array $db
Method Summary
 void __construct ([Sylar_DataBaseConfiguration $dbConfiguration = null], string $useDB)
 void __destruct (string $useDB)
 int affectedRow ()
 resource connect ()
 boolean disconnect ()
 resource/boolean execQuery (string $query)
 resource execSmartQuery (string $query)
 array fetchArrayByName ()
 array fetchArrayByNum ()
 int getLastId ()
 boolean isConnected ()
 string quoteString (string $string, [boolean $autoDisconnect = true])
 mixed readField (int $rowNumber, string $fieldName)
 boolean resetResults ()
 integer resultRows ()
 boolean setConnectionInfo (Sylar_DataBaseConfiguration $dbConf, string $useDB)
Variables
array $db (line 55)

Param container it's an array that contains all information on DB connection.

  • access: protected
  • todo: create special class container for the param
Methods
Constructor __construct (line 71)

Constructor.

It loads the configuration info for database from config file

void __construct ([Sylar_DataBaseConfiguration $dbConfiguration = null], string $useDB)
  • string $useDB: the label of db in use

Redefined in descendants as:
Destructor __destruct (line 96)

Destructor.

void __destruct (string $useDB)
  • string $useDB: the label of db in use

Redefined in descendants as:
affectedRow (line 295)

Affected Row.

Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE query on error return false

int affectedRow ()
connect (line 149)

Open a connection.

Open a connect to Database MySQL adn return the resource to MySQL connection or FALSE on failure.

resource connect ()
disconnect (line 170)

Close the connection.

It close the connection to Db if opened.

boolean disconnect ()
execQuery (line 194)

Exec a SQL query.

The connection to database must be opened. It exec a query and return MySQL result resource, or FALSE on error.

It also return a boolean value if the query is an update/insert/delete

resource/boolean execQuery (string $query)
  • string $query: la query SQL da eseguire sul DB impostato nel costruttore
execSmartQuery (line 228)

connect exec and disconnect open connection, exec query and close the connection.

It connect to database and execute the query. It returns a resurse result

resource execSmartQuery (string $query)
  • string $query: la query SQL da eseguire sul DB impostato nel costruttore
fetchArrayByName (line 330)

read a row in an array.

returns an array with all field of row in associative indices Array with columns name

array fetchArrayByName ()
fetchArrayByNum (line 344)

read a row in an array.

returns an array with all field of row in number indices Array

array fetchArrayByNum ()
getLastId (line 274)

Get the last ID.

it returns the ID generated for an AUTO_INCREMENT column by the previous INSERT query on success On error returns false

int getLastId ()
isConnected (line 135)

Check connection status Return true if the connection with database is up, false otherwise.

boolean isConnected ()
quoteString (line 378)

Escapes string for use in SQL.

It escapes special characters in a string for use in a SQL statement

It returns a string with escape character, on errore returns false

string quoteString (string $string, [boolean $autoDisconnect = true])
  • string $string: the string to quote
  • boolean $autoDisconnect: disconnect when finish. Default is TRUE
readField (line 316)

Read a particoular value.

returns the value of the field named $fieldName at row $rowNumber

mixed readField (int $rowNumber, string $fieldName)
  • string $fieldName: name ov field to read
  • int $rowNumber: number of row starting from 0.
resetResults (line 414)

Reset Results

It resets all data in the result variables.

boolean resetResults ()
resultRows (line 359)

total rows number.

the number of rows returned by a query like select

integer resultRows ()
setConnectionInfo (line 110)

Set Connection Info Retrive and load the connection info from configuration file

boolean setConnectionInfo (Sylar_DataBaseConfiguration $dbConf, string $useDB)
  • string $useDB

Documentation generated on Thu, 24 Apr 2008 16:14:19 +0200 by phpDocumentor 1.3.0RC3