The driver for the MySQL database connection and controlling.

package webkdb
author thg2oo6
copyright Copyright (c) 2012
version 1.0
access public

 Methods

Initialises the MySQL driver.

__construct(string $hostname, string $username, string $password, string $database) 

Parameters

$hostname

string

The address of the mysql server.

$username

string

The username used to connect to the database.

$password

string

The password used to connect to the database.

$database

string

The name of the database to be used.

Generates a DELETE query string.

delete(string $table) : \QueryBuilder

Parameters

$table

string

The table to execute the DELETE query.

Returns

Tests if there were errors during the execution of the last query.

error() : void

If thee were errors, the function will throw an DBException.

Generates a INSERT query string.

insert(string $table) : \QueryBuilder

Parameters

$table

string

The table to execute the INSERT query.

Returns

Returns the ID of the last executed insert query.

insert_id() : integer

Returns

integer

Returns the string of the last executed query.

last_query() : string

Returns

string

Returns the number of the rows returned by the executed query.

num_rows() : integer

Returns

integer

Executes a query and returns its result.

query(string $sql) : \WResult

Parameters

$sql

string

The query to be executed.

Returns

Returns an array with the database results represented as objects.

result() : array

Returns

array

Returns an array with the database results represented as associative array.

result_array() : array

Returns

array

Returns a row from the select query (object).

row() : object

In case of multiple rows it returns only the first one.

Returns

object

Returns a row from the select query (array).

row_array() : array

In case of multiple rows it returns only the first one.

Returns

array

Generates a SELECT query string.

select(string $table) : \QueryBuilder

Parameters

$table

string

The table to execute the SELECT query.

Returns

Generates a TRUNCATE query string.

truncate(string $table) : \QueryBuilder

Parameters

$table

string

The table to execute the TRUNCATE query.

Returns

Generates a UPDATE query string.

update(string $table) : \QueryBuilder

Parameters

$table

string

The table to execute the UPDATE query.

Returns

 Properties

 

The mysql connection link.

$_connection : \mysqli

 

The last executed query.

$_lastQ : \WQuery