Class DbConnect

Description

Begin Document

Located in /classes/class_DbConnect.php (line 35)


	
			
Variable Summary
static string $instance
string $DB_DATABASE
integer $errno
string $error
mixed $insert_id
boolean $is_locked
string $link
boolean $log_errors
integer $query_count
string $recent_link
boolean $show_errors
string $sql
Method Summary
DbConnect __construct ()
integer affected_rows ()
boolean close (none 0)
void connect ()
mixed Connection ()
string errno (none 0)
string error (none 0)
array fetch_array (string $result)
boolean free_result (string $result)
void hide_errors ()
integer insert_id ()
void lock (array $tables)
integer num_queries (none 0)
integer num_rows (string $result)
string prepare (string $value, [bool $do_like = false])
mixed query (string $sql, [bool $only_first = false])
string raise_error ([string $error_message = ''])
void show_errors ()
void unlock ()
mixed _get ( $property)
Variables
static string $instance (line 112)

The variable used to contain a singleton instance of the database connection.

string $affected_rows (line 119)

The number of rows affected by the most recent query.

  • access: public
string $DB_DATABASE (line 105)

The Database.

  • access: public
integer $errno = '' (line 77)

The error number of the most recent database error message.

string $error = '' (line 70)

The text of the most recent database error message.

mixed $insert_id (line 121)
  • access: public
boolean $is_locked = false (line 84)

Do we currently have a lock in place?

string $link (line 42)

Connection to MySQL.

boolean $log_errors = false (line 98)

Log errors? If set to true, the error message/sql is logged.

  • access: public
integer $query_count = 0 (line 63)

Holds the number of queries executed.

string $recent_link = null (line 49)

Holds the most recent connection.

boolean $show_errors = false (line 91)

Show errors? If set to true, the error message/sql is displayed.

string $sql = '' (line 56)

Holds the contents of the most recent SQL query.

Methods
Constructor __construct (line 128)

Constructor. Initializes a database connection and selects our database.

DbConnect __construct ()
affected_rows (line 247)

Retuns the number of rows affected by the most recent query

integer affected_rows ()
close (line 362)

Closes our connection to MySQL.

boolean close (none 0)
  • none 0
connect (line 172)

Connect to the Database.

void connect ()
Connection (line 158)

Singleton pattern to retrieve database connection.

  • return: MySQL database connection
mixed Connection ()
errno (line 386)

Returns the MySQL error number.

string errno (none 0)
  • none 0
error (line 374)

Returns the MySQL error message.

string error (none 0)
  • none 0
fetch_array (line 226)

Fetches a row from a query result and returns the values from that row as an array.

array fetch_array (string $result)
  • string $result: The query result we are dealing with.
free_result (line 335)

Frees memory associated with a query result.

boolean free_result (string $result)
  • string $result: The query result we are dealing with.
hide_errors (line 351)

Turns database error reporting off

void hide_errors ()
insert_id (line 302)

Returns the ID of the most recently inserted item in an auto_increment field

integer insert_id ()
lock (line 270)

Lock database tables

void lock (array $tables)
  • array $tables: Array of table => lock type
num_queries (line 259)

Returns the number of queries executed.

integer num_queries (none 0)
  • none 0
num_rows (line 237)

Returns the number of rows in a result set.

integer num_rows (string $result)
  • string $result: The query result we are dealing with.
prepare (line 314)

Escapes a value to make it safe for using in queries.

string prepare (string $value, [bool $do_like = false])
  • string $value: Value to be escaped
  • bool $do_like: Do we need to escape this string for a LIKE statement?
query (line 192)

Executes a sql query. If optional $only_first is set to true, it will return the first row of the result as an array.

mixed query (string $sql, [bool $only_first = false])
  • string $sql: Query to run
  • bool $only_first: Return only the first row, as an array?
raise_error (line 439)

If there is a database error, the script will be stopped and an error message displayed.

string raise_error ([string $error_message = ''])
  • string $error_message: The error message. If empty, one will be built with $this->sql.
show_errors (line 343)

Turns database error reporting on

void show_errors ()
unlock (line 289)

Unlock tables

void unlock ()
_get (line 141)

Singleton pattern to retrieve database connection.

  • return: MySQL database connection
mixed _get ( $property)
  • $property

Documentation generated on Tue, 05 Jan 2010 11:25:59 -0600 by phpDocumentor 1.4.3