GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • CodeIgniter v4.7 API

This view

  • Original page
  • New address

GeezerVison is showing codeigniter4.github.io — CodeIgniter v4.7 API

Menu

Namespaces

CodeIgniter

  • API
  • Autoloader
  • Cache
  • CLI
  • Commands
  • Config
  • Cookie
  • Database
  • DataCaster
  • DataConverter
  • Debug
  • Email
  • Encryption
  • Entity
  • Events
  • Exceptions
  • Files
  • Filters
  • Format
  • Helpers
  • Honeypot
  • HTTP
  • I18n
  • Images
  • Language
  • Log
  • Modules
  • Pager
  • Publisher
  • RESTful
  • Router
  • Security
  • Session
  • Test
  • Throttle
  • Traits
  • Typography
  • Validation
  • View

Packages

Application

Reports

Deprecated

Errors

Markers

Indices

Files

  • CodeIgniter
  • Database

BaseConnection
in package
  • Application
implements ConnectionInterface

AbstractYes
BaseConnection.php : 63
Tags
template
implements

Table of Contents

Interfaces

ConnectionInterface

Properties

$connID  : false|TConnection
Connection ID
$dataCache  : array<string, mixed>
$escapeChar  : array<int, string>|string
Identifier escape character
$likeEscapeChar  : string
ESCAPE character
$likeEscapeStr  : string
ESCAPE statement string
$protectIdentifiers  : bool
Protect identifiers flag
$resultID  : false|TResult
Result ID
$transEnabled  : bool
Transaction enabled flag
$transStrict  : bool
Strict transaction mode flag
$aliasedTables  : array<int, string>
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, bool|string>|bool
Encryption flag/data
$failover  : array<int, array<string, 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<int, string>
RegExp used to escape identifiers
$pretend  : bool
If true, no queries will actually be run against the database.
$queryClass  : string
Query Class
$reservedIdentifiers  : array<int, string>
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
$propertyBuiltinTypesCache  : array<class-string, array<string, array<int, string>>>
Cached builtin type names per class/property.

Methods

__construct()  : mixed
__get()  : mixed
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()  : mixed
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{code: int|string|null, message: string|null}
Returns the last error code and message.
escape()  : ($str is array ? array : float|int|string)
"Smart" Escape String
escapeIdentifier()  : string
Escape the SQL Identifier
escapeIdentifiers()  : ($item is array ? array : 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|TConnection
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|TConnection
Create a persistent database connection.
ping()  : bool
Check if the connection is still alive.
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()  : ($item is array ? array : string)
Protect Identifiers
query()  : BaseResult<TConnection, TResult>|bool|Query
Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it.
reconnect()  : void
Keep or establish the connection if no queries have been sent for a length of time exceeding the server's idle timeout.
resetDataCache()  : $this
Empties our data cache. Especially helpful during testing.
resetTransStatus()  : static
Reset transaction status - to restart transactions after strict mode failure
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|TResult
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.
_ping()  : bool
Driver-specific ping implementation.
_transBegin()  : bool
Begin Transaction
_transCommit()  : bool
Commit Transaction
_transRollback()  : bool
Rollback Transaction
abandonLostTransaction()  : void
The socket that owned the transaction is already closed.
execute()  : false|TResult
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.
castScalarValueForTypedProperty()  : mixed
Some config values (especially env overrides without clear source type) can still reach us as strings. Coerce them for typed properties to keep strict typing compatible.
escapeTableName()  : string
Returns escaped table name with alias.
getBuiltinPropertyTypesMap()  : array<string, array<int, string>>
protectDotItem()  : string
trimEscapeChar()  : string

Properties

$connID

BaseConnection.php : 221

Connection ID

public false|TConnection $connID = false

$dataCache

BaseConnection.php : 277
public array<string, mixed> $dataCache = []

$escapeChar

BaseConnection.php : 251

Identifier escape character

public array<int, string>|string $escapeChar = '"'

$likeEscapeChar

BaseConnection.php : 265

ESCAPE character

public string $likeEscapeChar = '!'

$likeEscapeStr

BaseConnection.php : 258

ESCAPE statement string

public string $likeEscapeStr = " ESCAPE '%s' "

$protectIdentifiers

BaseConnection.php : 235

Protect identifiers flag

public bool $protectIdentifiers = true

$resultID

BaseConnection.php : 228

Result ID

public false|TResult $resultID = false

$transEnabled

BaseConnection.php : 306

Transaction enabled flag

public bool $transEnabled = true

$transStrict

BaseConnection.php : 313

Strict transaction mode flag

public bool $transStrict = true

$aliasedTables

BaseConnection.php : 350

Array of table aliases.

protected array<int, string> $aliasedTables = []

$charset

BaseConnection.php : 158

Character set

protected string $charset = ''

This value must be updated by Config\Database if the driver use it.

$compress

BaseConnection.php : 188

Compression flag

protected bool $compress = false

$connectDuration

BaseConnection.php : 291

How long it took to establish connection.

protected float $connectDuration = 0.0

$connectTime

BaseConnection.php : 284

Microtime when connection was made

protected float $connectTime = 0.0

$database

BaseConnection.php : 112

Database name

protected string $database

$dateFormat

BaseConnection.php : 364

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

BaseConnection.php : 167

Collation

protected string $DBCollat = ''

This value must be updated by Config\Database if the driver use it.

$DBDebug

BaseConnection.php : 149

Whether to throw Exception or not when an error occurs.

protected bool $DBDebug = true

$DBDriver

BaseConnection.php : 119

Database driver

protected string $DBDriver = 'MySQLi'

$DBPrefix

BaseConnection.php : 135

Table prefix

protected string $DBPrefix = ''

$DSN

BaseConnection.php : 77

Data Source Name / Connect string

protected string $DSN

$encrypt

BaseConnection.php : 181

Encryption flag/data

protected array<string, bool|string>|bool $encrypt = false

$failover

BaseConnection.php : 206

Settings for a failover connection.

protected array<int, array<string, mixed>> $failover = []

$hostname

BaseConnection.php : 91

Hostname

protected string $hostname

$lastQuery

BaseConnection.php : 214

The last query object that was executed on this connection.

protected Query $lastQuery

$password

BaseConnection.php : 105

Password

protected string $password

$pConnect

BaseConnection.php : 142

Persistent connection flag

protected bool $pConnect = false

$port

BaseConnection.php : 84

Database port

protected int|string $port = ''

$pregEscapeChar

BaseConnection.php : 272

RegExp used to escape identifiers

protected array<int, string> $pregEscapeChar = []

$pretend

BaseConnection.php : 299

If true, no queries will actually be run against the database.

protected bool $pretend = false

$queryClass

BaseConnection.php : 357

Query Class

protected string $queryClass = \CodeIgniter\Database\Query::class

$reservedIdentifiers

BaseConnection.php : 244

List of reserved identifiers

protected array<int, string> $reservedIdentifiers = ['*']

Identifiers that must NOT be escaped.

$strictOn

BaseConnection.php : 199

Strict ON flag

Will move to MySQLi\Connection.

protected bool|null $strictOn

Whether we're running in strict SQL mode.

$subdriver

BaseConnection.php : 128

Sub-driver

protected string $subdriver
Tags
used-by

CI_DB_pdo_driver

$swapPre

BaseConnection.php : 174

Swap Prefix

protected string $swapPre = ''

$transDepth

BaseConnection.php : 320

Transaction depth level

protected int $transDepth = 0

$transException

BaseConnection.php : 343

Whether to throw exceptions during transaction

protected bool $transException = false

$transFailure

BaseConnection.php : 338

Transaction failure flag

protected bool $transFailure = false

Used with transactions to determine if a transaction has failed.

$transStatus

BaseConnection.php : 329

Transaction status flag

protected bool $transStatus = true

Used with transactions to determine if a rollback should occur.

$username

BaseConnection.php : 98

Username

protected string $username

$propertyBuiltinTypesCache

BaseConnection.php : 70

Cached builtin type names per class/property.

private static array<class-string, array<string, array<int, string>>> $propertyBuiltinTypesCache = []

Methods

__construct()

BaseConnection.php : 375
public __construct(array<string, mixed> $params) : mixed
Parameters
$params : array<string, mixed>

__get()

BaseConnection.php : 2084

Accessor for properties if they exist.

public __get(string $key) : mixed
Parameters
$key : string

__isset()

BaseConnection.php : 2096

Checker for properties existence.

public __isset(string $key) : bool
Parameters
$key : string
Return values
bool

addTableAlias()

BaseConnection.php : 776

Add a table alias to our list.

public addTableAlias(string $alias) : $this
Parameters
$alias : string
Return values
$this

affectedRows()

BaseConnection.php : 1554

Returns the total number of rows affected by this query.

public abstract affectedRows() : int
Return values
int

callFunction()

BaseConnection.php : 1672

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, mixed ...$params) : mixed
Parameters
$functionName : string
$params : mixed
Tags
throws
DatabaseException

close()

BaseConnection.php : 616

Close the database connection.

public close() : void

disableForeignKeyChecks()

BaseConnection.php : 1920

Disables foreign key checks temporarily.

public disableForeignKeyChecks() : bool
Return values
bool

enableForeignKeyChecks()

BaseConnection.php : 1937

Enables foreign key checks temporarily.

public enableForeignKeyChecks() : bool
Return values
bool

error()

BaseConnection.php : 1993

Returns the last error code and message.

public abstract error() : array{code: int|string|null, message: string|null}

Must return an array with keys 'code' and 'message':

Return values
array{code: int|string|null, message: string|null}

escape()

BaseConnection.php : 1566

"Smart" Escape String

public escape(mixed $str) : ($str is array ? array : float|int|string)

Escapes data based on type. Sets boolean and null types

Parameters
$str : mixed
Return values
($str is array ? array : float|int|string)

escapeIdentifier()

BaseConnection.php : 1443

Escape the SQL Identifier

public escapeIdentifier(non-empty-string|TableName $item) : string

This function escapes single identifier.

Parameters
$item : non-empty-string|TableName
Return values
string

escapeIdentifiers()

BaseConnection.php : 1482

Escape the SQL Identifiers

public escapeIdentifiers(array<string|int, mixed>|string $item) : ($item is array ? array : string)

This function escapes column and table names

Parameters
$item : array<string|int, mixed>|string
Return values
($item is array ? array : string)

escapeLikeString()

BaseConnection.php : 1649

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>|string

escapeString()

BaseConnection.php : 1599

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>|string

fieldExists()

BaseConnection.php : 1839

Determine if a particular field exists

public fieldExists(string $fieldName, string $tableName) : bool
Parameters
$fieldName : string
$tableName : string
Return values
bool

getConnectDuration()

BaseConnection.php : 1241

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
string

getConnection()

BaseConnection.php : 713

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|TConnection
Parameters
$alias : string|null = null
Return values
false|TConnection

getConnectStart()

BaseConnection.php : 1230

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|null

getDatabase()

BaseConnection.php : 722

Returns the name of the current database being used.

public getDatabase() : string
Return values
string

getFieldData()

BaseConnection.php : 1849

Returns an object with field data

public getFieldData(string $table) : array<int, stdClass>
Parameters
$table : string
Return values
array<int, stdClass>

getFieldNames()

BaseConnection.php : 1792

Fetch Field Names

public getFieldNames(string|TableName $tableName) : false|array<int, string>
Parameters
$tableName : string|TableName
Tags
throws
DatabaseException
Return values
false|array<int, string>

getForeignKeyData()

BaseConnection.php : 1869

Returns an object with foreign key data

public getForeignKeyData(string $table) : array<string, stdClass>
Parameters
$table : string
Return values
array<string, stdClass>

getIndexData()

BaseConnection.php : 1859

Returns an object with key data

public getIndexData(string $table) : array<string, stdClass>
Parameters
$table : string
Return values
array<string, stdClass>

getLastQuery()

BaseConnection.php : 1211

Returns the last query's statement object.

public getLastQuery() : Query
Return values
Query

getPlatform()

BaseConnection.php : 750

The name of the platform in use (MySQLi, Postgre, SQLite3, OCI8, etc)

public getPlatform() : string
Return values
string

getPrefix()

BaseConnection.php : 742

Returns the database prefix.

public getPrefix() : string
Return values
string

initialize()

BaseConnection.php : 532

Initializes the database connection/settings.

public initialize() : void
Tags
throws
DatabaseException

insertID()

BaseConnection.php : 2000

Insert ID

public abstract insertID() : int|string
Return values
int|string

isWriteType()

BaseConnection.php : 1981

Determines if the statement is a write-type query or not.

public isWriteType(string $sql) : bool
Parameters
$sql : string
Return values
bool

listTables()

BaseConnection.php : 1710

Returns an array of table names

public listTables([bool $constrainByPrefix = false ]) : false|array<int, string>
Parameters
$constrainByPrefix : bool = false
Tags
throws
DatabaseException
Return values
false|array<int, string>

newQuery()

BaseConnection.php : 1154

Returns a new instance of the BaseBuilder class with a cleared FROM clause.

public newQuery() : BaseBuilder
Return values
BaseBuilder

persistentConnect()

BaseConnection.php : 700

Create a persistent database connection.

public persistentConnect() : false|TConnection
Return values
false|TConnection

ping()

BaseConnection.php : 672

Check if the connection is still alive.

public ping() : bool
Return values
bool

prefixTable()

BaseConnection.php : 1542

Prepends a database prefix if one exists in configuration

public prefixTable([string $table = '' ]) : string
Parameters
$table : string = ''
Tags
throws
DatabaseException
Return values
string

prepare()

BaseConnection.php : 1183

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(callable(BaseConnection): mixed $func[, array<string, mixed> $options = [] ]) : BasePreparedQuery|null

Example: $stmt = $db->prepare(function($db) { return $db->table('users') ->where('id', 1) ->get(); })

Parameters
$func : callable(BaseConnection): mixed
$options : array<string, mixed> = []
Return values
BasePreparedQuery|null

pretend()

BaseConnection.php : 1957

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
$this

protectIdentifiers()

BaseConnection.php : 1273

Protect Identifiers

public protectIdentifiers(array<string|int, mixed>|int|string|TableName $item[, bool $prefixSingle = false ][, bool $protectIdentifiers = null ][, bool $fieldExists = true ]) : ($item is array ? array : 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|TableName
$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?

Return values
($item is array ? array : string)

query()

BaseConnection.php : 810

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<TConnection, TResult>|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
todo

BC set $queryClass default as null in 4.1

Return values
BaseResult<TConnection, TResult>|bool|Query

reconnect()

BaseConnection.php : 635

Keep or establish the connection if no queries have been sent for a length of time exceeding the server's idle timeout.

public reconnect() : void

A replaced socket is not in the transaction that was open on the old one. The server has already rolled that work back. Clear the depth and mark the transaction failed before opening the new connection, so a failed reconnect cannot still report success.

resetDataCache()

BaseConnection.php : 1969

Empties our data cache. Especially helpful during testing.

public resetDataCache() : $this
Return values
$this

resetTransStatus()

BaseConnection.php : 1097

Reset transaction status - to restart transactions after strict mode failure

public resetTransStatus() : static
Return values
static

setAliasedTables()

BaseConnection.php : 764

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<int, string> $aliases) : $this
Parameters
$aliases : array<int, string>
Return values
$this

setPrefix()

BaseConnection.php : 734

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
string

showLastQuery()

BaseConnection.php : 1219

Returns a string representation of the last query's statement object.

public showLastQuery() : string
Return values
string

simpleQuery()

BaseConnection.php : 922

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|TResult
Parameters
$sql : string
Return values
false|TResult

table()

BaseConnection.php : 1140

Returns a non-shared new instance of the query builder for this connection.

public table(array<string|int, string>|string|TableName $tableName) : BaseBuilder
Parameters
$tableName : array<string|int, string>|string|TableName
Tags
throws
DatabaseException
Return values
BaseBuilder

tableExists()

BaseConnection.php : 1749

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
bool

transBegin()

BaseConnection.php : 1025

Begin Transaction

public transBegin([bool $testMode = false ]) : bool
Parameters
$testMode : bool = false
Return values
bool

transCommit()

BaseConnection.php : 1059

Commit Transaction

public transCommit() : bool
Return values
bool

transComplete()

BaseConnection.php : 991

Complete Transaction

public transComplete() : bool
Return values
bool

transException()

BaseConnection.php : 981

If set to true, exceptions are thrown during transactions.

public transException(bool $transException) : $this
Parameters
$transException : bool
Return values
$this

transOff()

BaseConnection.php : 938

Disable Transactions

public transOff() : void

This permits transactions to be disabled at run-time.

transRollback()

BaseConnection.php : 1078

Rollback Transaction

public transRollback() : bool
Return values
bool

transStart()

BaseConnection.php : 967

Start Transaction

public transStart([bool $testMode = false ]) : bool
Parameters
$testMode : bool = false
Return values
bool

transStatus()

BaseConnection.php : 1017

Lets you retrieve the transaction flag to determine if it has failed

public transStatus() : bool
Return values
bool

transStrict()

BaseConnection.php : 957

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()

BaseConnection.php : 667

Platform dependent way method for closing the connection.

protected abstract _close() : void

_disableForeignKeyChecks()

BaseConnection.php : 2058

Platform-specific SQL statement to disable foreign key checks.

protected _disableForeignKeyChecks() : string

If this feature is not supported, return empty string.

Tags
TODO

This method should be moved to an interface that represents foreign key support.

see
disableForeignKeyChecks()
Return values
string

_enableForeignKeyChecks()

BaseConnection.php : 2074

Platform-specific SQL statement to enable foreign key checks.

protected _enableForeignKeyChecks() : string

If this feature is not supported, return empty string.

Tags
TODO

This method should be moved to an interface that represents foreign key support.

see
enableForeignKeyChecks()
Return values
string

_escapeString()

BaseConnection.php : 1659

Platform independent string escape.

protected _escapeString(string $str) : string

Will likely be overridden in child classes.

Parameters
$str : string
Return values
string

_fieldData()

BaseConnection.php : 2027

Platform-specific field data information.

protected abstract _fieldData(string $table) : array<int, stdClass>
Parameters
$table : string
Tags
see
getFieldData()
Return values
array<int, stdClass>

_foreignKeyData()

BaseConnection.php : 2045

Platform-specific foreign keys data.

protected abstract _foreignKeyData(string $table) : array<string, stdClass>
Parameters
$table : string
Tags
see
getForeignKeyData()
Return values
array<string, stdClass>

_indexData()

BaseConnection.php : 2036

Platform-specific index data.

protected abstract _indexData(string $table) : array<string, stdClass>
Parameters
$table : string
Tags
see
getIndexData()
Return values
array<string, stdClass>

_listColumns()

BaseConnection.php : 2018

Generates a platform-specific query string so that the column names can be fetched.

protected abstract _listColumns([string|TableName $table = '' ]) : false|string
Parameters
$table : string|TableName = ''
Return values
false|string

_listTables()

BaseConnection.php : 2009

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

_ping()

BaseConnection.php : 684

Driver-specific ping implementation.

protected _ping() : bool
Return values
bool

_transBegin()

BaseConnection.php : 1119

Begin Transaction

protected abstract _transBegin() : bool
Return values
bool

_transCommit()

BaseConnection.php : 1124

Commit Transaction

protected abstract _transCommit() : bool
Return values
bool

_transRollback()

BaseConnection.php : 1129

Rollback Transaction

protected abstract _transRollback() : bool
Return values
bool

abandonLostTransaction()

BaseConnection.php : 656

The socket that owned the transaction is already closed.

protected abandonLostTransaction() : void

Drivers that keep transaction state in PHP, rather than only on the server, must override this.

execute()

BaseConnection.php : 794

Executes the query against the database.

protected abstract execute(string $sql) : false|TResult
Parameters
$sql : string
Return values
false|TResult

foreignKeyDataToObjects()

BaseConnection.php : 1890

Converts array of arrays generated by _foreignKeyData() to array of objects

protected foreignKeyDataToObjects(array<string|int, array{constraint_name: string|null, table_name: string, column_name: list, foreign_table_name: string, foreign_column_name: list, on_delete: string, on_update: string|null, match: string|null}> $data) : array<string, stdClass>
Parameters
$data : array<string|int, array{constraint_name: string|null, table_name: string, column_name: list, foreign_table_name: string, foreign_column_name: list, on_delete: string, on_update: string|null, match: string|null}>
Return values
array<string, stdClass>

getDriverFunctionPrefix()

BaseConnection.php : 1694

Get the prefix of the function to access the DB.

protected getDriverFunctionPrefix() : string
Return values
string

castScalarValueForTypedProperty()

BaseConnection.php : 414

Some config values (especially env overrides without clear source type) can still reach us as strings. Coerce them for typed properties to keep strict typing compatible.

private castScalarValueForTypedProperty(mixed $value, array<int, string> $types) : mixed
Parameters
$value : mixed
$types : array<int, string>

escapeTableName()

BaseConnection.php : 1465

Returns escaped table name with alias.

private escapeTableName(TableName $tableName) : string
Parameters
$tableName : TableName
Return values
string

getBuiltinPropertyTypesMap()

BaseConnection.php : 464
private getBuiltinPropertyTypesMap(array<int, string> $properties) : array<string, array<int, string>>
Parameters
$properties : array<int, string>
Return values
array<string, array<int, string>>

protectDotItem()

BaseConnection.php : 1367
private protectDotItem(string $item, string $alias, bool $protectIdentifiers, bool $fieldExists) : string
Parameters
$item : string
$alias : string
$protectIdentifiers : bool
$fieldExists : bool
Return values
string

trimEscapeChar()

BaseConnection.php : 1362
private trimEscapeChar(string $item) : string
Parameters
$item : string
Return values
string
On this page
  • Table Of Contents
    • Properties
    • Methods
  • Properties
    • $connID
    • $dataCache
    • $escapeChar
    • $likeEscapeChar
    • $likeEscapeStr
    • $protectIdentifiers
    • $resultID
    • $transEnabled
    • $transStrict
    • $aliasedTables
    • $charset
    • $compress
    • $connectDuration
    • $connectTime
    • $database
    • $dateFormat
    • $DBCollat
    • $DBDebug
    • $DBDriver
    • $DBPrefix
    • $DSN
    • $encrypt
    • $failover
    • $hostname
    • $lastQuery
    • $password
    • $pConnect
    • $port
    • $pregEscapeChar
    • $pretend
    • $queryClass
    • $reservedIdentifiers
    • $strictOn
    • $subdriver
    • $swapPre
    • $transDepth
    • $transException
    • $transFailure
    • $transStatus
    • $username
    • $propertyBuiltinTypesCache
  • Methods
    • __construct()
    • __get()
    • __isset()
    • addTableAlias()
    • affectedRows()
    • callFunction()
    • close()
    • disableForeignKeyChecks()
    • enableForeignKeyChecks()
    • error()
    • escape()
    • escapeIdentifier()
    • escapeIdentifiers()
    • escapeLikeString()
    • escapeString()
    • fieldExists()
    • getConnectDuration()
    • getConnection()
    • getConnectStart()
    • getDatabase()
    • getFieldData()
    • getFieldNames()
    • getForeignKeyData()
    • getIndexData()
    • getLastQuery()
    • getPlatform()
    • getPrefix()
    • initialize()
    • insertID()
    • isWriteType()
    • listTables()
    • newQuery()
    • persistentConnect()
    • ping()
    • prefixTable()
    • prepare()
    • pretend()
    • protectIdentifiers()
    • query()
    • reconnect()
    • resetDataCache()
    • resetTransStatus()
    • setAliasedTables()
    • setPrefix()
    • showLastQuery()
    • simpleQuery()
    • table()
    • tableExists()
    • transBegin()
    • transCommit()
    • transComplete()
    • transException()
    • transOff()
    • transRollback()
    • transStart()
    • transStatus()
    • transStrict()
    • _close()
    • _disableForeignKeyChecks()
    • _enableForeignKeyChecks()
    • _escapeString()
    • _fieldData()
    • _foreignKeyData()
    • _indexData()
    • _listColumns()
    • _listTables()
    • _ping()
    • _transBegin()
    • _transCommit()
    • _transRollback()
    • abandonLostTransaction()
    • execute()
    • foreignKeyDataToObjects()
    • getDriverFunctionPrefix()
    • castScalarValueForTypedProperty()
    • escapeTableName()
    • getBuiltinPropertyTypesMap()
    • protectDotItem()
    • trimEscapeChar()
    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.