Extend PHP's PDO class to add some more functionality

package | miniMVC
subpackage | System

### Methods

## Override __call in trait to call __call in Query Builder...lol

    __call(string $name, array $params) : mixed

### Parameters

#### $name

`string`

#### $params

`array`

### Returns

`mixed`

## Constructor to override JSObject trait

    __construct(array $params)

### Parameters

#### $params

`array`

## Retreive the number of rows in the selected table

    count_all(string $table) : int

Inherited

inherited_from | \Query_Builder::count_all()

### Parameters

#### $table

`string`

### Returns

`int`

## Retrieve the number of results for the generated query - used in place of the get() method

    count_all_results(string $table) : int

Inherited

inherited_from | \Query_Builder::count_all_results()

### Parameters

#### $table

`string`

### Returns

`int`

## Deletes data from a table

    delete(string $table, mixed $where) : mixed

Inherited

inherited_from | \Query_Builder::delete()

### Parameters

#### $table

`string`

#### $where

`mixed`

### Returns

`mixed`

## Adds the 'distinct' keyword to a query

    distinct() : \DB

Inherited

inherited_from | \Query_Builder::distinct()
fluent | This method is part of a fluent interface and will return the same instance

### Returns

`\DB`

## Specify the database table to select from

    from(string $dbname) : \DB

Inherited

inherited_from | \Query_Builder::from()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $dbname

`string`

### Returns

`\DB`

## Select and retrieve all records from the current table, and/or execute current compiled query

    get($table, int $limit, int $offset) : object

Inherited

inherited_from | \Query_Builder::get()

### Parameters

#### $table

``

#### $limit

`int`

#### $offset

`int`

### Returns

`object`

## Indexed singleton method

    get_instance(string $dbname, array $options) : \DB

### Parameters

#### $dbname

`string`

#### $options

`array`

### Returns

`\DB`

## Returns the last error from the database

    get_last_error() : string

### Returns

`string`

## Convience method for get() with a where clause

    get_where(string $table, array $where, int $limit, int $offset) : object

Inherited

inherited_from | \Query_Builder::get_where()

### Parameters

#### $table

`string`

#### $where

`array`

#### $limit

`int`

#### $offset

`int`

### Returns

`object`

## Group the results by the selected field(s)

    group_by(mixed $field) : \DB

Inherited

inherited_from | \Query_Builder::group_by()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`mixed`

### Returns

`\DB`

## Ends a query group

    group_end() : \DB

Inherited

inherited_from | \Query_Builder::group_end()
fluent | This method is part of a fluent interface and will return the same instance

### Returns

`\DB`

## Adds a paren to the current query for query grouping

    group_start() : \DB

Inherited

inherited_from | \Query_Builder::group_start()
fluent | This method is part of a fluent interface and will return the same instance

### Returns

`\DB`

## Generates a 'Having' clause

    having(mixed $key, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::having()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`mixed`

#### $val

`mixed`

### Returns

`\DB`

## Creates an insert clause, and executes it

    insert(string $table, mixed $data) : mixed

Inherited

inherited_from | \Query_Builder::insert()

### Parameters

#### $table

`string`

#### $data

`mixed`

### Returns

`mixed`

## Creates a join phrase in a compiled query

    join(string $table, string $condition, string $type) : \DB

Inherited

inherited_from | \Query_Builder::join()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $table

`string`

#### $condition

`string`

#### $type

`string`

### Returns

`\DB`

## Creates a Like clause in the sql statement

    like(string $field, mixed $val, string $pos) : \DB

Inherited

inherited_from | \Query_Builder::like()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

#### $pos

`string`

### Returns

`\DB`

## Set a limit on the current sql statement

    limit(int $limit, int $offset) : string

Inherited

inherited_from | \Query_Builder::limit()

### Parameters

#### $limit

`int`

#### $offset

`int`

### Returns

`string`

## Generates a NOT LIKE clause

    not_like(string $field, mixed $val, string $pos) : \DB

Inherited

inherited_from | \Query_Builder::not_like()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

#### $pos

`string`

### Returns

`\DB`

## Adds a paren to the current query for query grouping, prefixed with 'OR'

    or_group_start() : \DB

Inherited

inherited_from | \Query_Builder::or_group_start()
fluent | This method is part of a fluent interface and will return the same instance

### Returns

`\DB`

## Generates a 'Having' clause prefixed with 'OR'

    or_having(mixed $key, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::or_having()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`mixed`

#### $val

`mixed`

### Returns

`\DB`

## Generates an OR Like clause

    or_like(string $field, mixed $val, string $pos) : \DB

Inherited

inherited_from | \Query_Builder::or_like()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

#### $pos

`string`

### Returns

`\DB`

## Adds a paren to the current query for query grouping, prefixed with 'OR NOT'

    or_not_group_start() : \DB

Inherited

inherited_from | \Query_Builder::or_not_group_start()
fluent | This method is part of a fluent interface and will return the same instance

### Returns

`\DB`

## Generates a OR NOT LIKE clause

    or_not_like(string $field, mixed $val, string $pos) : \DB

Inherited

inherited_from | \Query_Builder::or_not_like()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

#### $pos

`string`

### Returns

`\DB`

## Where clause prefixed with "OR"

    or_where(string $key, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::or_where()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`string`

#### $val

`mixed`

### Returns

`\DB`

## Where in statement prefixed with "or"

    or_where_in(string $field, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::or_where_in()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

### Returns

`\DB`

## OR WHERE NOT IN (FOO) clause

    or_where_not_in(string $field, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::or_where_not_in()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

### Returns

`\DB`

## Order the results by the selected field(s)

    order_by(string $field, string $type) : \DB

Inherited

inherited_from | \Query_Builder::order_by()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $type

`string`

### Returns

`\DB`

## Specifies rows to select in a query

    select(string $fields) : \DB

Inherited

inherited_from | \Query_Builder::select()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $fields

`string`

### Returns

`\DB`

## Selects the average value of a field from a query

    select_avg(string $field, string $as) : \DB

Inherited

inherited_from | \Query_Builder::select_avg()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $as

`string`

### Returns

`\DB`

## Selects the maximum value of a field from a query

    select_max(string $field, string $as) : \DB

Inherited

inherited_from | \Query_Builder::select_max()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $as

`string`

### Returns

`\DB`

## Selects the minimum value of a field from a query

    select_min(string $field, string $as) : \DB

Inherited

inherited_from | \Query_Builder::select_min()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $as

`string`

### Returns

`\DB`

## Selects the sum of a field from a query

    select_sum(string $field, string $as) : \DB

Inherited

inherited_from | \Query_Builder::select_sum()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $as

`string`

### Returns

`\DB`

## Sets values for inserts / updates / deletes

    set(mixed $key, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::set()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`mixed`

#### $val

`mixed`

### Returns

`\DB`

## Creates an update clause, and executes it

    update(string $table, mixed $data) : mixed

Inherited

inherited_from | \Query_Builder::update()

### Parameters

#### $table

`string`

#### $data

`mixed`

### Returns

`mixed`

## Specify condition(s) in the where clause of a query Note: this function works with key / value, or a passed array with key / value pairs

    where(mixed $key, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::where()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`mixed`

#### $val

`mixed`

### Returns

`\DB`

## Where clause with 'IN' statement

    where_in(mixed $field, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::where_in()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`mixed`

#### $val

`mixed`

### Returns

`\DB`

## WHERE NOT IN (FOO) clause

    where_not_in(string $field, mixed $val) : \DB

Inherited

inherited_from | \Query_Builder::where_not_in()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

### Returns

`\DB`

## String together the sql statements for sending to the db

    _compile(string $type, string $table) : \$string

Inherited

inherited_from | \Query_Builder::_compile()

### Parameters

#### $type

`string`

#### $table

`string`

### Returns

`\$string`

## Simplify building having clauses

    _having(mixed $key, mixed $val, string $conj) : \DB

Inherited

inherited_from | \Query_Builder::_having()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`mixed`

#### $val

`mixed`

#### $conj

`string`

### Returns

`\DB`

## Simplify 'like' methods

    _like(string $field, mixed $val, string $pos, string $like, string $conj) : \DB

Inherited

inherited_from | \Query_Builder::_like()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $field

`string`

#### $val

`mixed`

#### $pos

`string`

#### $like

`string`

#### $conj

`string`

### Returns

`\DB`

## Clear out the class variables, so the next query can be run

    _reset() : void

Inherited

inherited_from | \Query_Builder::_reset()

## Method to simplify select_ methods

    _select(string $field, string $as) : string

Inherited

inherited_from | \Query_Builder::_select()

### Parameters

#### $field

`string`

#### $as

`string`

### Returns

`string`

## Do all the repeditive stuff for where/having type methods

    _where(mixed $key, mixed $val) : array

Inherited

inherited_from | \Query_Builder::_where()

### Parameters

#### $key

`mixed`

#### $val

`mixed`

### Returns

`array`

## Simplify where_in methods

    _where_in(mixed $key, mixed $val, $in, $conj) : \DB

Inherited

inherited_from | \Query_Builder::_where_in()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`mixed`

#### $val

`mixed`

#### $in

``

string

#### $conj

``

string

### Returns

`\DB`

## Simplify generating where string

    _where_string(mixed $key, mixed $val, string $conj) : \DB

Inherited

inherited_from | \Query_Builder::_where_string()
fluent | This method is part of a fluent interface and will return the same instance

### Parameters

#### $key

`mixed`

#### $val

`mixed`

#### $conj

`string`

### Returns

`\DB`

### Properties

## Convenience property for connection management

    $conn_name : string

Inherited

inherited_from | \Query_Builder::$$conn_name

## Alias to $this->db->sql

    $sql : \DB_PDO

Inherited

inherited_from | \Query_Builder::$$sql

## Compiled 'from' clause

    $from_string : string

Inherited

inherited_from | \Query_Builder::$$from_string

## Key/val pairs for group by clause

    $group_array : array

Inherited

inherited_from | \Query_Builder::$$group_array

## Group by clause

    $group_string : string

Inherited

inherited_from | \Query_Builder::$$group_string

## Map for having clause

    $having_map : array

Inherited

inherited_from | \Query_Builder::$$having_map

## DB connection instances

    $instance : array

## Value for limit string

    $limit : int

Inherited

inherited_from | \Query_Builder::$$limit

## Value for offset in limit string

    $offset : int

Inherited

inherited_from | \Query_Builder::$$offset

## Key/val pairs for order by clause

    $order_array : array

Inherited

inherited_from | \Query_Builder::$$order_array

## Order by clause

    $order_string : string

Inherited

inherited_from | \Query_Builder::$$order_string

## Query component order mapping for complex select queries

    $query_map : array

Inherited

Format:

array( 'type' => 'where', 'conjunction' => ' AND ', 'string' => 'k=?' )

inherited_from | \Query_Builder::$$query_map

## Compiled 'select' clause

    $select_string : string

Inherited

inherited_from | \Query_Builder::$$select_string

## Keys for insert/update statement

    $set_array_keys : array

Inherited

inherited_from | \Query_Builder::$$set_array_keys

## Compiled arguments for insert / update

    $set_string : string

Inherited

inherited_from | \Query_Builder::$$set_string

## Values to apply to prepared statements

    $values : array

Inherited

inherited_from | \Query_Builder::$$values