class ODBC (View source)

Constants

ATTR_CONNECT_TIMEOUT

Connection attribute to set the connection timeout.

ATTR_DEFAULT_FETCH_MODE

Connection attribute to set the default fetch mode.

ATTR_AUTOCOMMIT

Connection attribute to set auto-commit mode.

ATTR_PERSISTENT

Connection attribute to set persistence of the connection.

ATTR_ALIAS_TYPE

Connection attribute to set the default fetch mode.

ATTR_REPORT

Connection attribute to set the default report mode.

ATTR_SQL_CUR_USE

Connection attribute to set cursor.

REPORT_OFF

Turns reporting off

REPORT_ERROR

Report errors from mysqli function calls

REPORT_STRICT

Throw exception for errors instead of warnings

REPORT_INDEX

Report if no index or bad index was used in a query

REPORT_ALL

Report all errors

FETCH_LAZY

Fetch mode that starts fetching rows only when they are requested.

FETCH_ASSOC

Constant for the fetch mode representing fetching as an associative array

FETCH_NUM

Constant for the fetch mode representing fetching as a numeric array

FETCH_BOTH

Constant for the fetch mode representing fetching as both a numeric and associative array

FETCH_OBJ

Constant for the fetch mode representing fetching as an object

FETCH_BOUND

Fetch mode that requires explicit binding of PHP variables to fetch values.

FETCH_COLUMN

Constant for the fetch mode representing fetching a single column

FETCH_CLASS

Constant for the fetch mode representing fetching into a new instance of a specified class

FETCH_INTO

Constant for the fetch mode representing fetching into an existing object

private WIN_CMDLET

Path to the ODBC cmdlet on Windows.

private LINUX_CMDLET

Path to the ODBC cmdlet on Linux.

SQL_CUR_USE_IF_NEEDED

Path to the ODBC cmdlet on Linux.

SQL_CUR_USE_ODBC

Path to the ODBC cmdlet on Linux.

SQL_CUR_USE_DRIVER

Path to the ODBC cmdlet on Linux.

Methods

static mixed
getAttribute(mixed $name)

Retrieves the value of a specific attribute by name or constant.

static void
setAttribute(mixed $name, mixed $value)

Sets the value of a specific attribute by name or constant.

static string|int|bool|float
setType(mixed $input)

Sets the type of the input variable based on its value.

static false|array
fetchArray(mixed $res)

fetchArray function description.

static false|array
fetchAll(mixed $res)

Fetches all the rows from the given result set.

static array
fetchColumns(mixed $resource, string|null $tableName = null)

Fetches the columns from the given result set and optionally groups them by table name.

static array
fetchTables(mixed $resource)

Fetches tables from the given database resource and returns an array of table names.

static array|string
getMapperAliases()

Retrieves the mapper drivers for the ODBC connection.

static array
getDriverSettings()

Retrieves the available drivers on the current system, excluding specified ODBC drivers.

static array
getDriverSettingsByDriver(string $driver)

Retrieves the driver settings for a specific driver, based on the operating system.

static array
getAvailableAliases()

Retrieves the available drivers on the current system, excluding the specified ODBC drivers.

static array
getAvailableDrivers()

Retrieves the available drivers on the current system, excluding the specified ODBC drivers.

static array|string
getAliasByDriver(string $driver, string|null $type = null)

Get alias by driver.

Details

static mixed getAttribute(mixed $name)

Retrieves the value of a specific attribute by name or constant.

Parameters

mixed $name

The name of the attribute or the constant associated with it.

Return Value

mixed

The value of the attribute if found; null otherwise.

Exceptions

ReflectionException

static void setAttribute(mixed $name, mixed $value)

Sets the value of a specific attribute by name or constant.

Parameters

mixed $name

The name of the attribute or the constant associated with it. If null, the value is appended.

mixed $value

The value to set for the specified attribute.

Return Value

void

Exceptions

ReflectionException

static string|int|bool|float setType(mixed $input)

Sets the type of the input variable based on its value.

Parameters

mixed $input

the input variable to be typed

Return Value

string|int|bool|float

the typed input variable

static false|array fetchArray(mixed $res)

fetchArray function description.

Parameters

mixed $res

Return Value

false|array

static false|array fetchAll(mixed $res)

Fetches all the rows from the given result set.

Parameters

mixed $res

The result set to fetch rows from.

Return Value

false|array

The array of rows fetched from the result set.

static array fetchColumns(mixed $resource, string|null $tableName = null)

Fetches the columns from the given result set and optionally groups them by table name.

Parameters

mixed $resource

The result set to fetch columns from.

string|null $tableName

Optional. The table name to filter the columns by.

Return Value

array

The columns fetched, optionally grouped by table name.

static array fetchTables(mixed $resource)

Fetches tables from the given database resource and returns an array of table names.

Parameters

mixed $resource

The database resource.

Return Value

array

An array of table names.

static array|string getMapperAliases()

Retrieves the mapper drivers for the ODBC connection.

Return Value

array|string

The mapper drivers.

static array getDriverSettings()

Retrieves the available drivers on the current system, excluding specified ODBC drivers.

Return Value

array

Available drivers excluding specified ODBC drivers.

static array getDriverSettingsByDriver(string $driver)

Retrieves the driver settings for a specific driver, based on the operating system.

This method checks the operating system and calls the appropriate method to get the driver settings.

Parameters

string $driver

The name of the driver for which settings are to be retrieved.

Return Value

array

An array of driver settings for the specified driver.

static array getAvailableAliases()

Retrieves the available drivers on the current system, excluding the specified ODBC drivers.

Return Value

array

Available drivers excluding specified ODBC drivers

static array getAvailableDrivers()

Retrieves the available drivers on the current system, excluding the specified ODBC drivers.

Return Value

array

Available drivers excluding specified ODBC drivers

static array|string getAliasByDriver(string $driver, string|null $type = null)

Get alias by driver.

Parameters

string $driver

The driver to get the alias for.

string|null $type

Optional. The type of alias.

Return Value

array|string

The array of matched aliases or a single matched alias.