db_connection Class Reference

interface connection to a db More...

Inheritance diagram for db_connection:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 connected ()
 return if the connection is up with the base
 escapeString ($str)
 escape a string so that it is safe to include it in a query
 setDebug ($debug_mode)
 use debug mode
 setNoExecute ($no_execute)
 use no execute mode
 setError ()
 retrieve last error from database
 execute ($query)
 executes an sql query
 insertAndGetId ($query)
 do an insert and retrieve generated id
 select1 ($query)
 do a select that yields one row
 select ($query)
 do a select that yields multiple row
 close ()
 close this connection
 tableExists ($table_name)
 checks if a table exists
 createTableFromFile ($file, $prefix, $charset)
 creates a table from an sql file
 createTable ($query, $charset)
 creates a table
 htmlCharsetToMySqlCharset ($charset)
 convert a web charset to a MySql charset
 mySqlCharsetToHtmlCharset ($charset)
 convert a web charset to a MySql charset

Public Attributes

 $debug_mode
 debug flag (will output each query before executing it if true)
 $no_execute
 won't execute any statements if true
 $cumulated_sql_execution_time
 cumulated time taken to perform sql queries
 $error
 last error
 $knownDbCharset = array('utf8', 'latin1')

Detailed Description

interface connection to a db


Member Function Documentation

db_connection::close (  ) 

close this connection

Reimplemented in mysql.

db_connection::connected (  ) 

return if the connection is up with the base

Returns:
state of the connection

Reimplemented in mysql.

db_connection::createTable ( query,
charset 
)

creates a table

Parameters:
query query that contains the create table sql statement
charset default charset of MySql table

Reimplemented in mysql.

db_connection::createTableFromFile ( file,
prefix,
charset 
)

creates a table from an sql file

Parameters:
file path to sql file containing create sql statements
prefix if the sql statement contains {prefix} string, this is the string to use as replacement
charset charset to use when creating table

db_connection::escapeString ( str  ) 

escape a string so that it is safe to include it in a query

should be called by user code to escape all user provided variables

Parameters:
str the string to escape
Returns:
escaped string

Reimplemented in mysql.

db_connection::execute ( query  ) 

executes an sql query

Parameters:
query the query to execute (INSERT, UPDATE, DELETE)

Reimplemented in mysql.

db_connection::htmlCharsetToMySqlCharset ( charset  ) 

convert a web charset to a MySql charset

Parameters:
charset web charset to convert
Returns:
MySql charset

db_connection::insertAndGetId ( query  ) 

do an insert and retrieve generated id

Parameters:
query the insert query
Returns:
generated id

Reimplemented in mysql.

db_connection::mySqlCharsetToHtmlCharset ( charset  ) 

convert a web charset to a MySql charset

Parameters:
charset web charset to convert
Returns:
MySql charset

db_connection::select ( query  ) 

do a select that yields multiple row

Parameters:
query the select that returns only one row
Returns:
rows as an array of array, or false if there was an error

Reimplemented in mysql, and null_db.

db_connection::select1 ( query  ) 

do a select that yields one row

Parameters:
query the select that returns only one row
Returns:
row as an array, or false if there was an error

Reimplemented in mysql.

db_connection::setDebug ( debug_mode  ) 

use debug mode

Parameters:
debug_mode true (debug mode on), or false (debug mode off)

db_connection::setError (  ) 

retrieve last error from database

Reimplemented in mysql.

db_connection::setNoExecute ( no_execute  ) 

use no execute mode

Parameters:
no_execute true (no execute mode on), or false (no execute mode off)

db_connection::tableExists ( table_name  ) 

checks if a table exists

Reimplemented in mysql.


Member Data Documentation

db_connection::$cumulated_sql_execution_time

cumulated time taken to perform sql queries

db_connection::$debug_mode

debug flag (will output each query before executing it if true)

db_connection::$error

last error

db_connection::$no_execute

won't execute any statements if true


The documentation for this class was generated from the following file:
Generated on Mon Feb 19 19:11:58 2007 for Wiclear by  doxygen 1.4.7