2024年PHP日本大会

Pdo\pgsql 类

(PHP 8 >= 8.4.0)

简介

一个代表使用PostgreSQL PDO驱动程序的连接的PDO子类。

此驱动程序支持PostgreSQL方言的专用SQL查询解析器。它可以处理以下内容:

  • 单引号和双引号文本,使用双倍引号作为转义机制
  • C风格的“转义”字符串文本
  • 美元引号字符串文本
  • 双破折号和C风格注释(非嵌套)。
  • 支持??作为?运算符的转义序列。

类概要

class Pdo\Pgsql extends PDO {
/* 继承的常量 */
public const int PDO::PARAM_NULL;
public const int PDO::PARAM_BOOL = 5;
public const int PDO::PARAM_INT = 1;
public const int PDO::PARAM_STR = 2;
public const int PDO::PARAM_LOB = 3;
public const int PDO::PARAM_STMT = 4;
public const int PDO::PARAM_STR_NATL;
public const int PDO::PARAM_STR_CHAR;
public const int PDO::PARAM_EVT_FREE;
public const int PDO::FETCH_DEFAULT;
public const int PDO::FETCH_LAZY;
public const int PDO::FETCH_ASSOC;
public const int PDO::FETCH_NUM;
public const int PDO::FETCH_BOTH;
public const int PDO::FETCH_OBJ;
public const int PDO::FETCH_BOUND;
public const int PDO::FETCH_COLUMN;
public const int PDO::FETCH_CLASS;
public const int PDO::FETCH_INTO;
public const int PDO::FETCH_FUNC;
public const int PDO::FETCH_GROUP;
public const int PDO::FETCH_UNIQUE;
public const int PDO::FETCH_KEY_PAIR;
public const int PDO::FETCH_NAMED;
public const int PDO::ATTR_PREFETCH;
public const int PDO::ATTR_TIMEOUT;
public const int PDO::ATTR_ERRMODE;
public const int PDO::ATTR_SERVER_VERSION;
public const int PDO::ATTR_CLIENT_VERSION;
public const int PDO::ATTR_SERVER_INFO;
public const int PDO::ATTR_CONNECTION_STATUS;
public const int PDO::ATTR_CASE;
public const int PDO::ATTR_CURSOR_NAME;
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_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_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_DISABLE_PREPARES;
public const int ATTR_RESULT_MEMORY_SIZE;
public const int TRANSACTION_IDLE;
public const int TRANSACTION_ACTIVE;
public const int TRANSACTION_INTRANS;
public const int TRANSACTION_INERROR;
public const int TRANSACTION_UNKNOWN;
/* 方法 */
public copyFromArray(
    string $tableName,
    array $rows,
    string $separator = "\t",
    string $nullAs = "\\\\N",
    ?string $fields = null
): bool
public copyFromFile(
    string $tableName,
    string $filename,
    string $separator = "\t",
    string $nullAs = "\\\\N",
    ?string $fields = null
): bool
public copyToArray(
    string $tableName,
    string $separator = "\t",
    string $nullAs = "\\\\N",
    ?string $fields = null
): array|false
public copyToFile(
    string $tableName,
    string $filename,
    string $separator = "\t",
    string $nullAs = "\\\\N",
    ?string $fields = null
): bool
public getNotify(int $fetchMode = PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false
public getPid(): int
public lobOpen(string $oid, string $mode = "rb"): resource|false
public lobUnlink(string $oid): bool
public setNoticeCallback(?callable $callback): void
/* 继承方法 */
public PDO::__construct(
    string $dsn,
    ?string $username = null,
    #[\SensitiveParameter] ?string $password = null,
    ?array $options = null
)
public PDO::commit(): bool
public static PDO::connect(
    string $dsn,
    ?string $username = null,
    #[\SensitiveParameter] ?string $password = null,
    ?array $options = null
): static
public PDO::exec(string $statement): int|false
public PDO::getAttribute(int $attribute): mixed
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::setAttribute(int $attribute, mixed $value): bool
}

预定义常量

Pdo\Pgsql::ATTR_DISABLE_PREPARES
将查询和参数一起发送到服务器,避免需要单独创建命名预处理语句。如果查询只执行一次,这可以通过避免不必要的服务器往返来减少延迟。
Pdo\Pgsql::ATTR_RESULT_MEMORY_SIZE
返回分配给指定查询结果PDOStatement实例的内存量(以字节为单位),如果在查询执行前不存在结果,则返回null
Pdo\Pgsql::TRANSACTION_IDLE
Pdo\Pgsql::TRANSACTION_ACTIVE
Pdo\Pgsql::TRANSACTION_INTRANS
Pdo\Pgsql::TRANSACTION_INERROR
Pdo\Pgsql::TRANSACTION_UNKNOWN

目录

添加注释

用户贡献的注释

此页面没有用户贡献的注释。
To Top