BaseConnection
in package
implements
ConnectionInterface
Tags
Table of Contents
Interfaces
Properties
- $aliasedTables : array<string|int, mixed>
- $charset : string
- $compress : bool
- $connectDuration : float
- $connectTime : float
- $connID : false|object|resource
- Connection ID
- $database : string
- $dataCache : array<string|int, mixed>
- Holds previously looked up data for performance reasons.
- $dateFormat : array<string|int, mixed>
- $DBCollat : string
- $DBDebug : bool
- $DBDriver : string
- $DBPrefix : string
- $DSN : string
- $encrypt : array<string|int, mixed>|bool
- $escapeChar : array<string|int, mixed>|string
- Identifier escape character
- $failover : array<string|int, mixed>
- $hostname : string
- $lastQuery : Query
- $likeEscapeChar : string
- ESCAPE character
- $likeEscapeStr : string
- ESCAPE statement string
- $password : string
- $pConnect : bool
- $port : int|string
- $pretend : bool
- $protectIdentifiers : bool
- Protect identifiers flag
- $queryClass : string
- $reservedIdentifiers : array<string|int, mixed>
- $resultID : false|object|resource
- Result ID
- $strictOn : bool
- $subdriver : string
- $swapPre : string
- $transDepth : int
- $transEnabled : bool
- Transaction enabled flag
- $transFailure : bool
- $transStatus : bool
- $transStrict : bool
- Strict transaction mode flag
- $username : string
- $aliasedTables : array<string|int, mixed>
- Array of table aliases.
- $charset : string
- Character set
- $compress : bool
- Compression flag
- $connectDuration : float
- How long it took to establish connection.
- $connectTime : float
- Microtime when connection was made
- $database : string
- Database name
- $dateFormat : array<string, string>
- Default Date/Time formats
- $DBCollat : string
- Collation
- $DBDebug : bool
- Whether to throw Exception or not when an error occurs.
- $DBDriver : string
- Database driver
- $DBPrefix : string
- Table prefix
- $DSN : string
- Data Source Name / Connect string
- $encrypt : array<string|int, mixed>|bool
- Encryption flag/data
- $failover : array<string|int, mixed>
- Settings for a failover connection.
- $hostname : string
- Hostname
- $lastQuery : Query
- The last query object that was executed on this connection.
- $password : string
- Password
- $pConnect : bool
- Persistent connection flag
- $port : int|string
- Database port
- $pregEscapeChar : array<string|int, mixed>
- RegExp used to escape identifiers
- $pretend : bool
- If true, no queries will actually be run against the database.
- $queryClass : string
- Query Class
- $reservedIdentifiers : array<string|int, mixed>
- List of reserved identifiers
- $strictOn : bool|null
- Strict ON flag
- $subdriver : string
- Sub-driver
- $swapPre : string
- Swap Prefix
- $transDepth : int
- Transaction depth level
- $transException : bool
- Whether to throw exceptions during transaction
- $transFailure : bool
- Transaction failure flag
- $transStatus : bool
- Transaction status flag
- $username : string
- Username
Methods
- __construct() : mixed
- Saves our connection settings.
- __get() : array<string|int, mixed>|bool|float|int|object|resource|string|null
- Accessor for properties if they exist.
- __isset() : bool
- Checker for properties existence.
- addTableAlias() : $this
- Add a table alias to our list.
- affectedRows() : int
- Returns the total number of rows affected by this query.
- callFunction() : array<string|int, mixed>|bool|float|int|object|resource|string|null
- This function enables you to call PHP database functions that are not natively included in CodeIgniter, in a platform independent manner.
- close() : void
- Close the database connection.
- disableForeignKeyChecks() : bool
- Disables foreign key checks temporarily.
- enableForeignKeyChecks() : bool
- Enables foreign key checks temporarily.
- error() : array<string, int|string|null>
- Returns the last error code and message.
- escape() : array<string|int, mixed>|float|int|string
- "Smart" Escape String
- escapeIdentifier() : string
- Escape the SQL Identifier
- escapeIdentifiers() : array<string|int, mixed>|string
- Escape the SQL Identifiers
- escapeLikeString() : array<int, string>|string
- Escape LIKE String
- escapeString() : array<int, string>|string
- Escape String
- fieldExists() : bool
- Determine if a particular field exists
- getConnectDuration() : string
- Returns the number of seconds with microseconds that it took to connect to the database.
- getConnection() : false|object|resource
- Returns the actual connection object. If both a 'read' and 'write' connection has been specified, you can pass either term in to get that connection. If you pass either alias in and only a single connection is present, it must return the sole connection.
- getConnectStart() : float|null
- Returns the time we started to connect to this database in seconds with microseconds.
- getDatabase() : string
- Returns the name of the current database being used.
- getFieldData() : array<int, stdClass>
- Returns an object with field data
- getFieldNames() : false|array<int, string>
- Fetch Field Names
- getForeignKeyData() : array<string, stdClass>
- Returns an object with foreign key data
- getIndexData() : array<string, stdClass>
- Returns an object with key data
- getLastQuery() : Query
- Returns the last query's statement object.
- getPlatform() : string
- The name of the platform in use (MySQLi, Postgre, SQLite3, OCI8, etc)
- getPrefix() : string
- Returns the database prefix.
- initialize() : void
- Initializes the database connection/settings.
- insertID() : int|string
- Insert ID
- isWriteType() : bool
- Determines if the statement is a write-type query or not.
- listTables() : false|array<int, string>
- Returns an array of table names
- newQuery() : BaseBuilder
- Returns a new instance of the BaseBuilder class with a cleared FROM clause.
- persistentConnect() : false|object|resource
- Create a persistent database connection.
- prefixTable() : string
- Prepends a database prefix if one exists in configuration
- prepare() : BasePreparedQuery|null
- Creates a prepared statement with the database that can then be used to execute multiple statements against. Within the closure, you would build the query in any normal way, though the Query Builder is the expected manner.
- pretend() : $this
- Allows the engine to be set into a mode where queries are not actually executed, but they are still generated, timed, etc.
- protectIdentifiers() : array<string|int, mixed>|string
- Protect Identifiers
- query() : BaseResult|bool|Query
- Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it.
- resetDataCache() : $this
- Empties our data cache. Especially helpful during testing.
- setAliasedTables() : $this
- Sets the Table Aliases to use. These are typically collected during use of the Builder, and set here so queries are built correctly.
- setPrefix() : string
- Set DB Prefix
- showLastQuery() : string
- Returns a string representation of the last query's statement object.
- simpleQuery() : false|object|resource
- Performs a basic query against the database. No binding or caching is performed, nor are transactions handled. Simply takes a raw query string and returns the database-specific result id.
- table() : BaseBuilder
- Returns a non-shared new instance of the query builder for this connection.
- tableExists() : bool
- Determine if a particular table exists
- transBegin() : bool
- Begin Transaction
- transCommit() : bool
- Commit Transaction
- transComplete() : bool
- Complete Transaction
- transException() : $this
- If set to true, exceptions are thrown during transactions.
- transOff() : void
- Disable Transactions
- transRollback() : bool
- Rollback Transaction
- transStart() : bool
- Start Transaction
- transStatus() : bool
- Lets you retrieve the transaction flag to determine if it has failed
- transStrict() : $this
- Enable/disable Transaction Strict Mode
- _close() : void
- Platform dependent way method for closing the connection.
- _disableForeignKeyChecks() : string
- Platform-specific SQL statement to disable foreign key checks.
- _enableForeignKeyChecks() : string
- Platform-specific SQL statement to enable foreign key checks.
- _escapeString() : string
- Platform independent string escape.
- _fieldData() : array<int, stdClass>
- Platform-specific field data information.
- _foreignKeyData() : array<string, stdClass>
- Platform-specific foreign keys data.
- _indexData() : array<string, stdClass>
- Platform-specific index data.
- _listColumns() : false|string
- Generates a platform-specific query string so that the column names can be fetched.
- _listTables() : false|string
- Generates the SQL for listing tables in a platform-dependent manner.
- _transBegin() : bool
- Begin Transaction
- _transCommit() : bool
- Commit Transaction
- _transRollback() : bool
- Rollback Transaction
- execute() : false|object|resource
- Executes the query against the database.
- foreignKeyDataToObjects() : array<string, stdClass>
- Converts array of arrays generated by _foreignKeyData() to array of objects
- getDriverFunctionPrefix() : string
- Get the prefix of the function to access the DB.
- protectDotItem() : string
Properties
$aliasedTables read-only
public
array<string|int, mixed>
$aliasedTables
$charset read-only
public
string
$charset
$compress read-only
public
bool
$compress
$connectDuration read-only
public
float
$connectDuration
$connectTime read-only
public
float
$connectTime
$connID
Connection ID
public
false|object|resource
$connID
= false
Tags
$database read-only
public
string
$database
$dataCache
Holds previously looked up data for performance reasons.
public
array<string|int, mixed>
$dataCache
= []
$dateFormat read-only
public
array<string|int, mixed>
$dateFormat
$DBCollat read-only
public
string
$DBCollat
$DBDebug read-only
public
bool
$DBDebug
$DBDriver read-only
public
string
$DBDriver
$DBPrefix read-only
public
string
$DBPrefix
$DSN read-only
public
string
$DSN
$encrypt read-only
public
array<string|int, mixed>|bool
$encrypt
$escapeChar
Identifier escape character
public
array<string|int, mixed>|string
$escapeChar
= '"'
$failover read-only
public
array<string|int, mixed>
$failover
$hostname read-only
public
string
$hostname
$lastQuery read-only
public
Query
$lastQuery
$likeEscapeChar
ESCAPE character
public
string
$likeEscapeChar
= '!'
$likeEscapeStr
ESCAPE statement string
public
string
$likeEscapeStr
= " ESCAPE '%s' "
$password read-only
public
string
$password
$pConnect read-only
public
bool
$pConnect
$port read-only
public
int|string
$port
$pretend read-only
public
bool
$pretend
$protectIdentifiers
Protect identifiers flag
public
bool
$protectIdentifiers
= true
$queryClass read-only
public
string
$queryClass
$reservedIdentifiers read-only
public
array<string|int, mixed>
$reservedIdentifiers
$resultID
Result ID
public
false|object|resource
$resultID
= false
Tags
$strictOn read-only
public
bool
$strictOn
$subdriver read-only
public
string
$subdriver
$swapPre read-only
public
string
$swapPre
$transDepth read-only
public
int
$transDepth
$transEnabled
Transaction enabled flag
public
bool
$transEnabled
= true
$transFailure read-only
public
bool
$transFailure
$transStatus read-only
public
bool
$transStatus
$transStrict
Strict transaction mode flag
public
bool
$transStrict
= true
$username read-only
public
string
$username
$aliasedTables
Array of table aliases.
protected
array<string|int, mixed>
$aliasedTables
= []
$charset
Character set
protected
string
$charset
= ''
This value must be updated by Config\Database if the driver use it.
$compress
Compression flag
protected
bool
$compress
= false
$connectDuration
How long it took to establish connection.
protected
float
$connectDuration
= 0.0
$connectTime
Microtime when connection was made
protected
float
$connectTime
= 0.0
$database
Database name
protected
string
$database
$dateFormat
Default Date/Time formats
protected
array<string, string>
$dateFormat
= ['date' => 'Y-m-d', 'datetime' => 'Y-m-d H:i:s', 'datetime-ms' => 'Y-m-d H:i:s.v', 'datetime-us' => 'Y-m-d H:i:s.u', 'time' => 'H:i:s']
$DBCollat
Collation
protected
string
$DBCollat
= ''
This value must be updated by Config\Database if the driver use it.
$DBDebug
Whether to throw Exception or not when an error occurs.
protected
bool
$DBDebug
= true
$DBDriver
Database driver
protected
string
$DBDriver
= 'MySQLi'
$DBPrefix
Table prefix
protected
string
$DBPrefix
= ''
$DSN
Data Source Name / Connect string
protected
string
$DSN
$encrypt
Encryption flag/data
protected
array<string|int, mixed>|bool
$encrypt
= false
$failover
Settings for a failover connection.
protected
array<string|int, mixed>
$failover
= []
$hostname
Hostname
protected
string
$hostname
$lastQuery
The last query object that was executed on this connection.
protected
Query
$lastQuery
$password
Password
protected
string
$password
$pConnect
Persistent connection flag
protected
bool
$pConnect
= false
$port
Database port
protected
int|string
$port
= ''
$pregEscapeChar
RegExp used to escape identifiers
protected
array<string|int, mixed>
$pregEscapeChar
= []
$pretend
If true, no queries will actually be run against the database.
protected
bool
$pretend
= false
$queryClass
Query Class
protected
string
$queryClass
= \CodeIgniter\Database\Query::class
$reservedIdentifiers
List of reserved identifiers
protected
array<string|int, mixed>
$reservedIdentifiers
= ['*']
Identifiers that must NOT be escaped.
$strictOn
Strict ON flag
Will move to MySQLi\Connection.
protected
bool|null
$strictOn
Whether we're running in strict SQL mode.
$subdriver
Sub-driver
protected
string
$subdriver
Tags
$swapPre
Swap Prefix
protected
string
$swapPre
= ''
$transDepth
Transaction depth level
protected
int
$transDepth
= 0
$transException
Whether to throw exceptions during transaction
protected
bool
$transException
= false
$transFailure
Transaction failure flag
protected
bool
$transFailure
= false
Used with transactions to determine if a transaction has failed.
$transStatus
Transaction status flag
protected
bool
$transStatus
= true
Used with transactions to determine if a rollback should occur.
$username
Username
protected
string
$username
Methods
__construct()
Saves our connection settings.
public
__construct(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
__get()
Accessor for properties if they exist.
public
__get(string $key) : array<string|int, mixed>|bool|float|int|object|resource|string|null
Parameters
- $key : string
Return values
array<string|int, mixed>|bool|float|int|object|resource|string|null__isset()
Checker for properties existence.
public
__isset(string $key) : bool
Parameters
- $key : string
Return values
booladdTableAlias()
Add a table alias to our list.
public
addTableAlias(string $table) : $this
Parameters
- $table : string
Return values
$thisaffectedRows()
Returns the total number of rows affected by this query.
public
abstract affectedRows() : int
Return values
intcallFunction()
This function enables you to call PHP database functions that are not natively included in CodeIgniter, in a platform independent manner.
public
callFunction(string $functionName, array<string|int, mixed> ...$params) : array<string|int, mixed>|bool|float|int|object|resource|string|null
Parameters
- $functionName : string
- $params : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>|bool|float|int|object|resource|string|nullclose()
Close the database connection.
public
close() : void
disableForeignKeyChecks()
Disables foreign key checks temporarily.
public
disableForeignKeyChecks() : bool
Return values
boolenableForeignKeyChecks()
Enables foreign key checks temporarily.
public
enableForeignKeyChecks() : bool
Return values
boolerror()
Returns the last error code and message.
public
abstract error() : array<string, int|string|null>
Must return an array with keys 'code' and 'message':
Tags
Return values
array<string, int|string|null>escape()
"Smart" Escape String
public
escape(array<string|int, mixed>|bool|float|int|object|string|null $str) : array<string|int, mixed>|float|int|string
Escapes data based on type. Sets boolean and null types
Parameters
- $str : array<string|int, mixed>|bool|float|int|object|string|null
Tags
Return values
array<string|int, mixed>|float|int|stringescapeIdentifier()
Escape the SQL Identifier
public
escapeIdentifier(non-empty-string $item) : string
This function escapes single identifier.
Parameters
- $item : non-empty-string
Return values
stringescapeIdentifiers()
Escape the SQL Identifiers
public
escapeIdentifiers(array<string|int, mixed>|string $item) : array<string|int, mixed>|string
This function escapes column and table names
Parameters
- $item : array<string|int, mixed>|string
Tags
Return values
array<string|int, mixed>|stringescapeLikeString()
Escape LIKE String
public
escapeLikeString(array<int, string|Stringable>|string|Stringable $str) : array<int, string>|string
Calls the individual driver for platform specific escaping for LIKE conditions
Parameters
- $str : array<int, string|Stringable>|string|Stringable
Return values
array<int, string>|stringescapeString()
Escape String
public
escapeString(array<int, string|Stringable>|string|Stringable $str[, bool $like = false ]) : array<int, string>|string
Parameters
- $str : array<int, string|Stringable>|string|Stringable
-
Input string
- $like : bool = false
-
Whether the string will be used in a LIKE condition
Return values
array<int, string>|stringfieldExists()
Determine if a particular field exists
public
fieldExists(string $fieldName, string $tableName) : bool
Parameters
- $fieldName : string
- $tableName : string
Return values
boolgetConnectDuration()
Returns the number of seconds with microseconds that it took to connect to the database.
public
getConnectDuration([int $decimals = 6 ]) : string
Used by the Debug Toolbar's timeline.
Parameters
- $decimals : int = 6
Return values
stringgetConnection()
Returns the actual connection object. If both a 'read' and 'write' connection has been specified, you can pass either term in to get that connection. If you pass either alias in and only a single connection is present, it must return the sole connection.
public
getConnection([string|null $alias = null ]) : false|object|resource
Parameters
- $alias : string|null = null
Tags
Return values
false|object|resourcegetConnectStart()
Returns the time we started to connect to this database in seconds with microseconds.
public
getConnectStart() : float|null
Used by the Debug Toolbar's timeline.
Return values
float|nullgetDatabase()
Returns the name of the current database being used.
public
getDatabase() : string
Return values
stringgetFieldData()
Returns an object with field data
public
getFieldData(string $table) : array<int, stdClass>
Parameters
- $table : string
Return values
array<int, stdClass>getFieldNames()
Fetch Field Names
public
getFieldNames(string $table) : false|array<int, string>
Parameters
- $table : string
Tags
Return values
false|array<int, string>getForeignKeyData()
Returns an object with foreign key data
public
getForeignKeyData(string $table) : array<string, stdClass>
Parameters
- $table : string
Return values
array<string, stdClass>getIndexData()
Returns an object with key data
public
getIndexData(string $table) : array<string, stdClass>
Parameters
- $table : string
Return values
array<string, stdClass>getLastQuery()
Returns the last query's statement object.
public
getLastQuery() : Query
Return values
QuerygetPlatform()
The name of the platform in use (MySQLi, Postgre, SQLite3, OCI8, etc)
public
getPlatform() : string
Return values
stringgetPrefix()
Returns the database prefix.
public
getPrefix() : string
Return values
stringinitialize()
Initializes the database connection/settings.
public
initialize() : void
Tags
insertID()
Insert ID
public
abstract insertID() : int|string
Return values
int|stringisWriteType()
Determines if the statement is a write-type query or not.
public
isWriteType(string $sql) : bool
Parameters
- $sql : string
Return values
boollistTables()
Returns an array of table names
public
listTables([bool $constrainByPrefix = false ]) : false|array<int, string>
Parameters
- $constrainByPrefix : bool = false
Tags
Return values
false|array<int, string>newQuery()
Returns a new instance of the BaseBuilder class with a cleared FROM clause.
public
newQuery() : BaseBuilder
Return values
BaseBuilderpersistentConnect()
Create a persistent database connection.
public
persistentConnect() : false|object|resource
Tags
Return values
false|object|resourceprefixTable()
Prepends a database prefix if one exists in configuration
public
prefixTable([string $table = '' ]) : string
Parameters
- $table : string = ''
Tags
Return values
stringprepare()
Creates a prepared statement with the database that can then be used to execute multiple statements against. Within the closure, you would build the query in any normal way, though the Query Builder is the expected manner.
public
prepare(Closure $func[, array<string|int, mixed> $options = [] ]) : BasePreparedQuery|null
Example: $stmt = $db->prepare(function($db) { return $db->table('users') ->where('id', 1) ->get(); })
Parameters
- $func : Closure
- $options : array<string|int, mixed> = []
Return values
BasePreparedQuery|nullpretend()
Allows the engine to be set into a mode where queries are not actually executed, but they are still generated, timed, etc.
public
pretend([bool $pretend = true ]) : $this
This is primarily used by the prepared query functionality.
Parameters
- $pretend : bool = true
Return values
$thisprotectIdentifiers()
Protect Identifiers
public
protectIdentifiers(array<string|int, mixed>|int|string $item[, bool $prefixSingle = false ][, bool $protectIdentifiers = null ][, bool $fieldExists = true ]) : array<string|int, mixed>|string
This function is used extensively by the Query Builder class, and by a couple functions in this class. It takes a column or table name (optionally with an alias) and inserts the table prefix onto it. Some logic is necessary in order to deal with column names that include the path. Consider a query like this:
SELECT hostname.database.table.column AS c FROM hostname.database.table
Or a query with aliasing:
SELECT m.member_id, m.member_name FROM members AS m
Since the column name can include up to four segments (host, DB, table, column) or also have an alias prefix, we need to do a bit of work to figure this out and insert the table prefix (if it exists) in the proper position, and escape only the correct identifiers.
Parameters
- $item : array<string|int, mixed>|int|string
- $prefixSingle : bool = false
-
Prefix a table name with no segments?
- $protectIdentifiers : bool = null
-
Protect table or column names?
- $fieldExists : bool = true
-
Supplied $item contains a column name?
Tags
Return values
array<string|int, mixed>|stringquery()
Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it.
public
query(string $sql[, array<string|int, mixed>|string|null $binds = null ][, bool $setEscapeFlags = true ][, string $queryClass = '' ]) : BaseResult|bool|Query
This method works with the cache.
Should automatically handle different connections for read/write queries if needed.
Parameters
- $sql : string
- $binds : array<string|int, mixed>|string|null = null
- $setEscapeFlags : bool = true
- $queryClass : string = ''
Tags
Return values
BaseResult|bool|Query —BaseResult when “read” type query, bool when “write” type query, Query when prepared query
resetDataCache()
Empties our data cache. Especially helpful during testing.
public
resetDataCache() : $this
Return values
$thissetAliasedTables()
Sets the Table Aliases to use. These are typically collected during use of the Builder, and set here so queries are built correctly.
public
setAliasedTables(array<string|int, mixed> $aliases) : $this
Parameters
- $aliases : array<string|int, mixed>
Return values
$thissetPrefix()
Set DB Prefix
public
setPrefix([string $prefix = '' ]) : string
Set's the DB Prefix to something new without needing to reconnect
Parameters
- $prefix : string = ''
-
The prefix
Return values
stringshowLastQuery()
Returns a string representation of the last query's statement object.
public
showLastQuery() : string
Return values
stringsimpleQuery()
Performs a basic query against the database. No binding or caching is performed, nor are transactions handled. Simply takes a raw query string and returns the database-specific result id.
public
simpleQuery(string $sql) : false|object|resource
Parameters
- $sql : string
Tags
Return values
false|object|resourcetable()
Returns a non-shared new instance of the query builder for this connection.
public
table(array<string|int, mixed>|string $tableName) : BaseBuilder
Parameters
- $tableName : array<string|int, mixed>|string
Tags
Return values
BaseBuildertableExists()
Determine if a particular table exists
public
tableExists(string $tableName[, bool $cached = true ]) : bool
Parameters
- $tableName : string
- $cached : bool = true
-
Whether to use data cache
Return values
booltransBegin()
Begin Transaction
public
transBegin([bool $testMode = false ]) : bool
Parameters
- $testMode : bool = false
Return values
booltransCommit()
Commit Transaction
public
transCommit() : bool
Return values
booltransComplete()
Complete Transaction
public
transComplete() : bool
Return values
booltransException()
If set to true, exceptions are thrown during transactions.
public
transException(bool $transException) : $this
Parameters
- $transException : bool
Return values
$thistransOff()
Disable Transactions
public
transOff() : void
This permits transactions to be disabled at run-time.
transRollback()
Rollback Transaction
public
transRollback() : bool
Return values
booltransStart()
Start Transaction
public
transStart([bool $testMode = false ]) : bool
Parameters
- $testMode : bool = false
Return values
booltransStatus()
Lets you retrieve the transaction flag to determine if it has failed
public
transStatus() : bool
Return values
booltransStrict()
Enable/disable Transaction Strict Mode
public
transStrict([bool $mode = true ]) : $this
When strict mode is enabled, if you are running multiple groups of transactions, if one group fails all subsequent groups will be rolled back.
If strict mode is disabled, each group is treated autonomously, meaning a failure of one group will not affect any others
Parameters
- $mode : bool = true
-
= true
Return values
$this_close()
Platform dependent way method for closing the connection.
protected
abstract _close() : void
_disableForeignKeyChecks()
Platform-specific SQL statement to disable foreign key checks.
protected
_disableForeignKeyChecks() : string
If this feature is not supported, return empty string.
Tags
Return values
string_enableForeignKeyChecks()
Platform-specific SQL statement to enable foreign key checks.
protected
_enableForeignKeyChecks() : string
If this feature is not supported, return empty string.
Tags
Return values
string_escapeString()
Platform independent string escape.
protected
_escapeString(string $str) : string
Will likely be overridden in child classes.
Parameters
- $str : string
Return values
string_fieldData()
Platform-specific field data information.
protected
abstract _fieldData(string $table) : array<int, stdClass>
Parameters
- $table : string
Tags
Return values
array<int, stdClass>_foreignKeyData()
Platform-specific foreign keys data.
protected
abstract _foreignKeyData(string $table) : array<string, stdClass>
Parameters
- $table : string
Tags
Return values
array<string, stdClass>_indexData()
Platform-specific index data.
protected
abstract _indexData(string $table) : array<string, stdClass>
Parameters
- $table : string
Tags
Return values
array<string, stdClass>_listColumns()
Generates a platform-specific query string so that the column names can be fetched.
protected
abstract _listColumns([string $table = '' ]) : false|string
Parameters
- $table : string = ''
Return values
false|string_listTables()
Generates the SQL for listing tables in a platform-dependent manner.
protected
abstract _listTables([bool $constrainByPrefix = false ][, string|null $tableName = null ]) : false|string
Parameters
- $constrainByPrefix : bool = false
- $tableName : string|null = null
-
If $tableName is provided will return only this table if exists.
Return values
false|string_transBegin()
Begin Transaction
protected
abstract _transBegin() : bool
Return values
bool_transCommit()
Commit Transaction
protected
abstract _transCommit() : bool
Return values
bool_transRollback()
Rollback Transaction
protected
abstract _transRollback() : bool
Return values
boolexecute()
Executes the query against the database.
protected
abstract execute(string $sql) : false|object|resource
Parameters
- $sql : string
Tags
Return values
false|object|resourceforeignKeyDataToObjects()
Converts array of arrays generated by _foreignKeyData() to array of objects
protected
foreignKeyDataToObjects(array<string|int, mixed> $data) : array<string, stdClass>
Parameters
- $data : array<string|int, mixed>
Return values
array<string, stdClass> —array[ {constraint_name} => stdClass[ 'constraint_name' => string, 'table_name' => string, 'column_name' => string[], 'foreign_table_name' => string, 'foreign_column_name' => string[], 'on_delete' => string, 'on_update' => string, 'match' => string ] ]
getDriverFunctionPrefix()
Get the prefix of the function to access the DB.
protected
getDriverFunctionPrefix() : string
Return values
stringprotectDotItem()
private
protectDotItem(string $item, string $alias, bool $protectIdentifiers, bool $fieldExists) : string
Parameters
- $item : string
- $alias : string
- $protectIdentifiers : bool
- $fieldExists : bool