(PHP 8 >= 8.4.0)
一个代表使用 ODBC PDO 驱动程序的连接的 PDO 子类。
public const int PDO::ATTR_CURSOR;
public const int PDO::ATTR_ORACLE_NULLS;
public const int PDO::ATTR_PERSISTENT;
public const int PDO::ATTR_STATEMENT_CLASS;
public const int PDO::ATTR_FETCH_TABLE_NAMES;
public const int PDO::ATTR_FETCH_CATALOG_NAMES;
public const int PDO::ATTR_DRIVER_NAME;
public const int PDO::ATTR_STRINGIFY_FETCHES;
public const int PDO::ATTR_MAX_COLUMN_LEN;
public const int PDO::ATTR_EMULATE_PREPARES;
public const int PDO::ATTR_DEFAULT_FETCH_MODE;
public const int PDO::ATTR_DEFAULT_STR_PARAM;
public const int PDO::ERRMODE_SILENT;
public const int PDO::ERRMODE_WARNING;
public const int PDO::ERRMODE_EXCEPTION;
public const int PDO::CASE_NATURAL;
public const int PDO::CASE_LOWER;
public const int PDO::CASE_UPPER;
public const int PDO::NULL_NATURAL;
public const int PDO::NULL_EMPTY_STRING;
public const int PDO::NULL_TO_STRING;
public const string PDO::ERR_NONE;
public const int PDO::FETCH_ORI_NEXT;
public const int PDO::FETCH_ORI_PRIOR;
public const int PDO::FETCH_ORI_FIRST;
public const int PDO::FETCH_ORI_LAST;
public const int PDO::FETCH_ORI_ABS;
public const int PDO::FETCH_ORI_REL;
public const int PDO::CURSOR_FWDONLY;
public const int PDO::CURSOR_SCROLL;
public const int ATTR_USE_CURSOR_LIBRARY;
public const int ATTR_ASSUME_UTF8;
public const int SQL_USE_IF_NEEDED;
public const int SQL_USE_DRIVER;
public const int SQL_USE_ODBC;
public PDO::__construct(
string $dsn
,?string $username = null
,#[\SensitiveParameter] ?string $password = null
,?array $options = null
public PDO::beginTransaction(): bool
public PDO::commit(): bool
public static PDO::connect(
string $dsn
,?string $username = null
,#[\SensitiveParameter] ?string $password = null
,?array $options = null
): static
public PDO::errorCode(): ?string
public PDO::errorInfo(): array
public PDO::exec(string $statement): int|false
public PDO::getAttribute(int $attribute): mixed
public static PDO::getAvailableDrivers(): array
public PDO::inTransaction(): bool
public PDO::lastInsertId(?string $name = null): string|false
public PDO::prepare(string $query
, array $options
= []): PDOStatement|false
public PDO::query(string $query
, ?int $fetchMode
= null
): PDOStatement|false
public PDO::query(string $query
, ?int $fetchMode
= PDO::FETCH_COLUMN, int $colno
): PDOStatement|false
public PDO::query(
string $query
,?int $fetchMode
= PDO::FETCH_CLASS
,string $classname
,array $constructorArgs
): PDOStatement|false
public PDO::query(string $query
, ?int $fetchMode
= PDO::FETCH_INTO, object $object
): PDOStatement|false
public PDO::quote(string $string
, int $type
= PDO::PARAM_STR): string|false
public PDO::rollBack(): bool
public PDO::setAttribute(int $attribute
, mixed $value
): bool
Pdo\Odbc::ATTR_USE_CURSOR_LIBRARY
此选项控制是否使用ODBC游标库。ODBC游标库支持一些高级ODBC功能(例如块可滚动游标),这些功能可能未由驱动程序实现。支持以下值:
Pdo\Odbc::SQL_USE_IF_NEEDED
Pdo\Odbc::SQL_USE_DRIVER
Pdo\Odbc::SQL_USE_ODBC
Pdo\Odbc::ATTR_ASSUME_UTF8
true
,则在读取或写入数据库数据时,将UTF-16编码的字符数据(CHAR
、VARCHAR
和LONGVARCHAR
)转换为UTF-8。如果为false
(默认值),则字符编码转换可能由驱动程序完成。