PHP Class iaDb

Subrion - open source content management system Copyright (C) 2016 Intelliants, LLC This file is part of Subrion. Subrion is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Subrion is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Subrion. If not, see .
Inheritance: extends abstractUtil, implements iaInterfaceDbAdapter
Show file Open project: intelliants/subrion Class Usage Examples

Public Properties

Property Type Description
$iaCore
$prefix
$tableOptions

Protected Properties

Property Type Description
$_PDO
$_PDOStmt
$_counter
$_lastQuery
$_link
$_queryList
$_table
$_tableList

Public Methods

Method Description
__construct ( )
all ( $fields = self::ALL_COLUMNS_SELECTION, $condition = '', $start, $limit = null, $tableName = null )
assoc ( $fields = self::ALL_COLUMNS_SELECTION, $condition = '', $tableName = null, $start, $limit = null )
bind ( &$sql, $values )
cascadeDelete ( $tbl, $where = '' )
convertIds ( $ids, $columnName = 'id', $equal = true )
delete ( $condition, $tableName = null, $values = [] )
describe ( $tableName = null, $addPrefix = true )
exists ( $where, $values = [], $tableName = null )
fetchRow ( $result ) : array | null Fetches one row of data from the result set and returns it as an enumerated array
foundRows ( )
getAffected ( )
getAll ( $sql, $start, $limit )
getAssoc ( $sql, $singleRow = false )
getCount ( )
getEnumValues ( $table, $field )
getError ( ) : string Returns the error text from the last MySQL function
getErrorNumber ( )
getFieldNames ( $result ) : array | boolean Returns an array of objects which contains field definition information or FALSE if no field information is available
getInfo ( $type ) : string Returns a string that represents various information on a connected database
getInsertId ( )
getKeyValue ( $sql )
getLastQuery ( )
getMaxOrder ( $table = null, $condition = null )
getNextId ( $table = null ) Returns the ID using auto increment value for a table
getNumFields ( ) : integer Retrieves the number of fields from a query
getNumFields ( $result ) : integer Retrieves the number of fields from a query
getNumRows ( $resource )
getOne ( $sql )
getPrefix ( )
getQueriesList ( )
getRow ( $sql )
init ( )
insert ( array $values, $rawValues = null, $tableName = null )
keyvalue ( $fields = self::ALL_COLUMNS_SELECTION, $condition = null, $tableName = null, $start, $limit = null )
mysqli_result ( $result, $row, $field )
one ( $field, $condition = '', $tableName = null, $start )
one_bind ( $field, $condition, array $values, $tableName = null, $start )
onefield ( $field = self::ID_COLUMN_SELECTION, $condition = null, $start, $limit = null, $tableName = null )
orderByRand ( $max, $id_name = '`id`', $pieces = 12, $delimiter = 100 )
printf ( $pattern, array $replacements )
query ( $sql )
replace ( array $values, $rawValues = null, $tableName = null )
resetTable ( )
row ( $fields = self::ALL_COLUMNS_SELECTION, $condition = '', $tableName = null, $start )
row_bind ( $fields, $condition, array $values, $tableName = null, $start )
setTable ( $tableName, $addPrefix = true )
setTimezoneOffset ( $offset )
sql ( string $string = '' ) : string Escapes string using valid connection
truncate ( $table = null )
update ( $values, $condition = null, $rawValues = null, $tableName = null )

Protected Methods

Method Description
_connect ( ) : void Creates connection to database
_get ( string $type, string | array $fields, string $condition = '', integer $start, integer | null $limit = null ) : array | boolean Converts short aliases into MySQL query format
_wrapValues ( array $values, array $rawValues ) : string Internal utility function used to generate SET stmt

Method Details

__construct() public method

public __construct ( )

_connect() protected method

Creates connection to database
protected _connect ( ) : void
return void

_get() protected method

Converts short aliases into MySQL query format
protected _get ( string $type, string | array $fields, string $condition = '', integer $start, integer | null $limit = null ) : array | boolean
$type string selection type
$fields string | array fields to be selected
$condition string condition to be used for the selection
$start integer start position
$limit integer | null number of records to be returned
return array | boolean

_wrapValues() protected method

Internal utility function used to generate SET stmt
protected _wrapValues ( array $values, array $rawValues ) : string
$values array values to be set checking by type
$rawValues array values to be set without processing
return string

all() public method

public all ( $fields = self::ALL_COLUMNS_SELECTION, $condition = '', $start, $limit = null, $tableName = null )

assoc() public method

public assoc ( $fields = self::ALL_COLUMNS_SELECTION, $condition = '', $tableName = null, $start, $limit = null )

bind() public method

public bind ( &$sql, $values )

cascadeDelete() public method

public cascadeDelete ( $tbl, $where = '' )

convertIds() public static method

public static convertIds ( $ids, $columnName = 'id', $equal = true )

delete() public method

public delete ( $condition, $tableName = null, $values = [] )

describe() public method

public describe ( $tableName = null, $addPrefix = true )

exists() public method

public exists ( $where, $values = [], $tableName = null )

fetchRow() public method

Fetches one row of data from the result set and returns it as an enumerated array
public fetchRow ( $result ) : array | null
$result query result
return array | null

foundRows() public method

public foundRows ( )

getAffected() public method

public getAffected ( )

getAll() public method

public getAll ( $sql, $start, $limit )

getAssoc() public method

public getAssoc ( $sql, $singleRow = false )

getCount() public method

public getCount ( )

getEnumValues() public method

public getEnumValues ( $table, $field )

getError() public method

Returns the error text from the last MySQL function
public getError ( ) : string
return string

getErrorNumber() public method

public getErrorNumber ( )

getFieldNames() public method

Returns an array of objects which contains field definition information or FALSE if no field information is available
public getFieldNames ( $result ) : array | boolean
$result query result
return array | boolean

getInfo() public method

Returns a string that represents various information on a connected database
public getInfo ( $type ) : string
$type information type
return string

getInsertId() public method

public getInsertId ( )

getKeyValue() public method

public getKeyValue ( $sql )

getLastQuery() public method

public getLastQuery ( )

getMaxOrder() public method

public getMaxOrder ( $table = null, $condition = null )

getNextId() public method

Returns the ID using auto increment value for a table
public getNextId ( $table = null )

getNumFields() public method

Retrieves the number of fields from a query
public getNumFields ( ) : integer
return integer

getNumFields() public method

Retrieves the number of fields from a query
public getNumFields ( $result ) : integer
$result query result
return integer

getNumRows() public method

public getNumRows ( $resource )

getOne() public method

public getOne ( $sql )

getPrefix() public method

public getPrefix ( )

getQueriesList() public method

public getQueriesList ( )

getRow() public method

public getRow ( $sql )

init() public method

public init ( )

insert() public method

public insert ( array $values, $rawValues = null, $tableName = null )
$values array

keyvalue() public method

public keyvalue ( $fields = self::ALL_COLUMNS_SELECTION, $condition = null, $tableName = null, $start, $limit = null )

mysqli_result() public method

public mysqli_result ( $result, $row, $field )

one() public method

public one ( $field, $condition = '', $tableName = null, $start )

one_bind() public method

public one_bind ( $field, $condition, array $values, $tableName = null, $start )
$values array

onefield() public method

public onefield ( $field = self::ID_COLUMN_SELECTION, $condition = null, $start, $limit = null, $tableName = null )

orderByRand() public method

public orderByRand ( $max, $id_name = '`id`', $pieces = 12, $delimiter = 100 )

printf() public static method

public static printf ( $pattern, array $replacements )
$replacements array

query() public method

public query ( $sql )

replace() public method

public replace ( array $values, $rawValues = null, $tableName = null )
$values array

resetTable() public method

public resetTable ( )

row() public method

public row ( $fields = self::ALL_COLUMNS_SELECTION, $condition = '', $tableName = null, $start )

row_bind() public method

public row_bind ( $fields, $condition, array $values, $tableName = null, $start )
$values array

setTable() public method

public setTable ( $tableName, $addPrefix = true )

setTimezoneOffset() public method

public setTimezoneOffset ( $offset )

sql() public method

Escapes string using valid connection
public sql ( string $string = '' ) : string
$string string string to be escaped
return string

truncate() public method

public truncate ( $table = null )

update() public method

public update ( $values, $condition = null, $rawValues = null, $tableName = null )

Property Details

$_PDO protected property

protected $_PDO

$_PDOStmt protected property

protected $_PDOStmt

$_counter protected property

protected $_counter

$_lastQuery protected property

protected $_lastQuery

$_queryList protected property

protected $_queryList

$_table protected property

protected $_table

$_tableList protected property

protected $_tableList

$iaCore public property

public $iaCore

$prefix public property

public $prefix

$tableOptions public property

public $tableOptions