模式

PostgreSQL数据库模型类
属性
命名空间 fize\db\realization\pgsql
类名 Mode
实现接口 fize\db\definition\Mode
方法:
方法名 说明
odbc() odbc方式构造
pgsql() pgsql方式构造
pdo() Pdo方式构造
getInstance() 数据库实例

方法

odbc()

odbc方式构造

public static function odbc (

    string $host,

    string $user,

    string $pwd,

    string $dbname,

    string|int $port = "",

    string $driver = null

) : \fize\db\realization\pgsql\mode\Odbc
参数:
名称 说明
host 服务器地址
user 用户名
pwd 用户密码
dbname 数据库名
port 端口号,选填,PostgreSQL默认是5432
driver 指定ODBC驱动名称。

pgsql()

pgsql方式构造

public static function pgsql (

    string $connection_string,

    bool $pconnect = false,

    int $connect_type = null

) : \fize\db\realization\pgsql\mode\Pgsql
参数:
名称 说明
connection_string 连接字符串
pconnect 是否使用长连接
connect_type PGSQL_CONNECT_FORCE_NEW使用新连接

pdo()

Pdo方式构造

public static function pdo (

    string $host,

    string $user,

    string $pwd,

    string $dbname,

    int $port = null,

    array $opts = []

) : \fize\db\realization\pgsql\mode\Pdo
参数:
名称 说明
host 服务器地址
user 用户名
pwd 用户密码
dbname 数据库名
port 端口号,选填,PostgreSQL默认是5432
opts PDO连接的其他选项,选填

getInstance()

数据库实例

public static function getInstance (

    string $mode,

    array $config

) : \fize\db\realization\pgsql\Db
参数:
名称 说明
mode 连接模式
config 数据库参数选项