• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pg_parameter_status函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中pg_parameter_status函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_parameter_status函数的具体用法?PHP pg_parameter_status怎么用?PHP pg_parameter_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pg_parameter_status函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: castLink

 public static function castLink($link, array $a, Stub $stub, $isNested)
 {
     $a['status'] = pg_connection_status($link);
     $a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
     $a['busy'] = pg_connection_busy($link);
     $a['transaction'] = pg_transaction_status($link);
     if (isset(self::$transactionStatus[$a['transaction']])) {
         $a['transaction'] = new ConstStub(self::$transactionStatus[$a['transaction']], $a['transaction']);
     }
     $a['pid'] = pg_get_pid($link);
     $a['last error'] = pg_last_error($link);
     $a['last notice'] = pg_last_notice($link);
     $a['host'] = pg_host($link);
     $a['port'] = pg_port($link);
     $a['dbname'] = pg_dbname($link);
     $a['options'] = pg_options($link);
     $a['version'] = pg_version($link);
     foreach (self::$paramCodes as $v) {
         if (false !== ($s = pg_parameter_status($link, $v))) {
             $a['param'][$v] = $s;
         }
     }
     $a['param']['client_encoding'] = pg_client_encoding($link);
     $a['param'] = new EnumStub($a['param']);
     return $a;
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:26,代码来源:PgSqlCaster.php


示例2: connect

 public function connect()
 {
     if ($this->_connection) {
         return;
     }
     try {
         $this->_connection = empty($this->_config['connection']['persistent']) ? pg_connect($this->_config['connection']['info'], PGSQL_CONNECT_FORCE_NEW) : pg_pconnect($this->_config['connection']['info'], PGSQL_CONNECT_FORCE_NEW);
     } catch (ErrorException $e) {
         throw new Database_Exception(':error', array(':error' => $e->getMessage()));
     }
     if (!is_resource($this->_connection)) {
         throw new Database_Exception('Unable to connect to PostgreSQL ":name"', array(':name' => $this->_instance));
     }
     $this->_version = pg_parameter_status($this->_connection, 'server_version');
     if (!empty($this->_config['charset'])) {
         $this->set_charset($this->_config['charset']);
     }
     if (empty($this->_config['schema'])) {
         // Assume the default schema without changing the search path
         $this->_config['schema'] = 'public';
     } else {
         if (!pg_send_query($this->_connection, 'SET search_path = ' . $this->_config['schema'] . ', pg_catalog')) {
             throw new Database_Exception(pg_last_error($this->_connection));
         }
         if (!($result = pg_get_result($this->_connection))) {
             throw new Database_Exception(pg_last_error($this->_connection));
         }
         if (pg_result_status($result) !== PGSQL_COMMAND_OK) {
             throw new Database_Exception(pg_result_error($result));
         }
     }
 }
开发者ID:alekseyshavrak,项目名称:3cx,代码行数:32,代码来源:PostgreSQL.php


示例3: sql_connect

 /**
  * Connect to server
  */
 function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
 {
     $connect_string = '';
     if ($sqluser) {
         $connect_string .= "user={$sqluser} ";
     }
     if ($sqlpassword) {
         $connect_string .= "password={$sqlpassword} ";
     }
     if ($sqlserver) {
         if (strpos($sqlserver, ':') !== false) {
             list($sqlserver, $port) = explode(':', $sqlserver);
         }
         if ($sqlserver !== 'localhost') {
             $connect_string .= "host={$sqlserver} ";
         }
         if ($port) {
             $connect_string .= "port={$port} ";
         }
     }
     $schema = '';
     if ($database) {
         $this->dbname = $database;
         if (strpos($database, '.') !== false) {
             list($database, $schema) = explode('.', $database);
         }
         $connect_string .= "dbname={$database}";
     }
     $this->persistency = $persistency;
     $this->db_connect_id = $this->persistency ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link);
     if ($this->db_connect_id) {
         // determine what version of PostgreSQL is running, we can be more efficient if they are running 8.2+
         if (version_compare(PHP_VERSION, '5.0.0', '>=')) {
             $this->pgsql_version = @pg_parameter_status($this->db_connect_id, 'server_version');
         } else {
             $query_id = @pg_query($this->db_connect_id, 'SELECT VERSION()');
             $row = @pg_fetch_assoc($query_id, null);
             @pg_free_result($query_id);
             if (!empty($row['version'])) {
                 $this->pgsql_version = substr($row['version'], 10);
             }
         }
         if (!empty($this->pgsql_version) && $this->pgsql_version[0] >= '8' && $this->pgsql_version[2] >= '2') {
             $this->multi_insert = true;
         }
         if ($schema !== '') {
             @pg_query($this->db_connect_id, 'SET search_path TO ' . $schema);
         }
         return $this->db_connect_id;
     }
     return $this->sql_error('');
 }
开发者ID:jambik,项目名称:elenaburgon,代码行数:55,代码来源:postgres.php


示例4: get_versions

 public function get_versions()
 {
     $version['engine'] = 'PostgreSQL';
     $version['client'] = 'N/A';
     $version['server'] = 'N/A';
     $version = array_merge($version, pg_version($this->_owner->connect_id));
     if ($version['server'] == 'N/A') {
         //pgsql not compiled into php
         $version['server'] = pg_parameter_status('server_version');
         //pgsql 7.4+
     }
     return $version;
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:13,代码来源:postgresql.php


示例5: get_versions

 function get_versions()
 {
     $version['engine'] = 'PostgreSQL';
     $version['client'] = 'N/A';
     $version['server'] = 'N/A';
     if (function_exists('pg_version')) {
         //php5+
         $version = array_merge($version, pg_version($this->_owner->connect_id));
         if ($version['server'] == 'N/A') {
             //pgsql not compiled into php
             $version['server'] = pg_parameter_status('server_version');
             //pgsql 7.4+
         }
     } else {
         if ($result = pg_query($this->_owner->connect_id, 'SELECT VERSION()')) {
             list($v) = pg_fetch_row($result);
             pg_free_result($result);
             if (!empty($v)) {
                 $version['server'] = preg_replace('#PostgreSQL ([0-9\\.]+).*#i', '\\1', $v);
             }
         }
     }
     return $version;
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:24,代码来源:postgresql_mngr.php


示例6: isSuperUser

 /**
  * Determines whether or not a user is a super user
  * @param $username The username of the user
  * @return True if is a super user, false otherwise
  */
 function isSuperUser($username = '')
 {
     $this->clean($username);
     if (empty($usename)) {
         $val = pg_parameter_status($this->conn->_connectionID, 'is_superuser');
         if ($val !== false) {
             return $val == 'on';
         }
     }
     $sql = "SELECT usesuper FROM pg_user WHERE usename='{$username}'";
     $usesuper = $this->selectField($sql, 'usesuper');
     if ($usesuper == -1) {
         return false;
     } else {
         return $usesuper == 't';
     }
 }
开发者ID:phppgadmin,项目名称:phppgadmin,代码行数:22,代码来源:Postgres.php


示例7: getAttribute

 /**
  * Public method:
  *	Quotes correctly a string for this database
  *       	this->getAttribute( $attribute:Integer ):Mixed
  * @Param	Integer		a constant [	PDO_ATTR_SERVER_INFO,
  * 						PDO_ATTR_SERVER_VERSION,
  *                                              PDO_ATTR_CLIENT_VERSION,
  *                                              PDO_ATTR_PERSISTENT	]
  * @Return	Mixed		correct information or false
  */
 function getAttribute($attribute)
 {
     $result = false;
     switch ($attribute) {
         case PDO_ATTR_SERVER_INFO:
             $result = pg_parameter_status($this->__connection, 'server_encoding');
             break;
         case PDO_ATTR_SERVER_VERSION:
             $result = pg_parameter_status($this->__connection, 'server_version');
             break;
         case PDO_ATTR_CLIENT_VERSION:
             $result = pg_parameter_status($this->__connection, 'server_version');
             $result .= ' ' . pg_parameter_status($this->__connection, 'client_encoding');
             break;
         case PDO_ATTR_PERSISTENT:
             $result = $this->__persistent;
             break;
     }
     return $result;
 }
开发者ID:D4rk4,项目名称:Kusaba-z,代码行数:30,代码来源:PDOStatement_pgsql.class.php


示例8: testRangeTypeConverterFromMetadata

 public function testRangeTypeConverterFromMetadata()
 {
     if (!TESTS_SAD_SPIRIT_PG_WRAPPER_CONNECTION_STRING) {
         $this->markTestSkipped('Connection string is not configured');
     }
     $connection = new Connection(TESTS_SAD_SPIRIT_PG_WRAPPER_CONNECTION_STRING, false);
     if (version_compare(pg_parameter_status($connection->getResource(), 'server_version'), '9.2.0', '<')) {
         $this->markTestSkipped('Connection to PostgreSQL 9.2+ required');
     }
     $connection->setTypeConverterFactory($this->factory);
     $connection->execute("drop type if exists textrange");
     $connection->execute("create type textrange as range (subtype=text, collation=\"C\")");
     $this->assertEquals(new RangeConverter(new StringConverter()), $this->factory->getConverter('textrange'));
 }
开发者ID:sad-spirit,项目名称:pg-wrapper,代码行数:14,代码来源:TypeConverterFactoryTest.php


示例9: check_postgres_version

 /**
  * check postgres serversion. at least 8.2 required
  *
  * @return mixed bool true if successful, false if unknown version, else server_version
  */
 public function check_postgres_version()
 {
     $server_version = pg_parameter_status($this->dbconn, "server_version");
     if (false !== $server_version) {
         if (-1 == version_compare($server_version, "8.2")) {
             return $server_version;
         }
         // version ok
         return true;
     }
     // unknown server_version
     return false;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:18,代码来源:setupdb.php


示例10: getAttribute

 public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null)
 {
     switch ($attribute) {
         case PDO::ATTR_AUTOCOMMIT:
             return $this->autocommit;
             break;
         case PDO::ATTR_CLIENT_VERSION:
             $ver = pg_version($this->link);
             return $ver['client'];
             break;
         case PDO::ATTR_CONNECTION_STATUS:
             if (pg_connection_status($this->link) === PGSQL_CONNECTION_OK) {
                 return 'Connection OK; waiting to send.';
             } else {
                 return 'Connection BAD';
             }
             break;
         case PDO::ATTR_SERVER_INFO:
             return sprintf('PID: %d; Client Encoding: %s; Is Superuser: %s; Session Authorization: %s; Date Style: %s', pg_get_pid($this->link), pg_client_encoding($this->link), pg_parameter_status($this->link, 'is_superuser'), pg_parameter_status($this->link, 'session_authorization'), pg_parameter_status($this->link, 'DateStyle'));
             break;
         case PDO::ATTR_SERVER_VERSION:
             return pg_parameter_status($this->link, 'server_version');
             break;
         default:
             return parent::getAttribute($attribute, $source, $func, $last_error);
             break;
     }
 }
开发者ID:PHPcomaptibility,项目名称:PHPPDO,代码行数:28,代码来源:pgsql.php


示例11: _loadTypes

    /**
     * Populates the types list from pg_catalog.pg_type table
     *
     * @param bool $force Force loading from database even if cached list is available
     * @throws exceptions\InvalidQueryException
     */
    private function _loadTypes($force = false)
    {
        $cacheKey = $this->_connection->getConnectionId() . '-types';
        if (!($cache = $this->_connection->getMetadataCache()) || $force || null === ($this->_dbTypes = $cache->getItem($cacheKey))) {
            $this->_dbTypes = array('composite' => array(), 'array' => array(), 'range' => array(), 'names' => array());
            $sql = <<<SQL
    select t.oid, nspname, typname, typarray, typrelid
    from pg_catalog.pg_type as t, pg_catalog.pg_namespace as s
    where t.typnamespace = s.oid and
          typtype != 'd'
    order by 4 desc
SQL;
            if (!($res = @pg_query($this->_connection->getResource(), $sql))) {
                throw new exceptions\InvalidQueryException(pg_last_error($this->_connection->getResource()));
            }
            while ($row = pg_fetch_assoc($res)) {
                if (!isset($this->_dbTypes['names'][$row['typname']])) {
                    $this->_dbTypes['names'][$row['typname']] = array($row['nspname'] => $row['oid']);
                } else {
                    $this->_dbTypes['names'][$row['typname']][$row['nspname']] = $row['oid'];
                }
                if ('0' !== $row['typarray']) {
                    $this->_dbTypes['array'][$row['typarray']] = $row['oid'];
                }
                if ('0' !== $row['typrelid']) {
                    $this->_dbTypes['composite'][$row['oid']] = $row['typrelid'];
                }
            }
            pg_free_result($res);
            if (version_compare(pg_parameter_status($this->_connection->getResource(), 'server_version'), '9.2.0', '>=')) {
                if (!($res = @pg_query($this->_connection->getResource(), "select rngtypid, rngsubtype from pg_range"))) {
                    throw new exceptions\InvalidQueryException(pg_last_error($this->_connection->getResource()));
                }
                while ($row = pg_fetch_assoc($res)) {
                    $this->_dbTypes['range'][$row['rngtypid']] = $row['rngsubtype'];
                }
            }
            if ($cache) {
                $cache->setItem($cacheKey, $this->_dbTypes);
            }
        }
        $this->_oidMap = array();
        foreach ($this->_dbTypes['names'] as $typeName => $schemas) {
            foreach ($schemas as $schemaName => $oid) {
                $this->_oidMap[$oid] = array($schemaName, $typeName);
            }
        }
    }
开发者ID:sad-spirit,项目名称:pg-wrapper,代码行数:54,代码来源:TypeConverterFactory.php


示例12: inputNotNull

 protected function inputNotNull($native)
 {
     foreach ($this->getFormats($this->_style) as $format) {
         if ($value = \DateTime::createFromFormat('!' . $format, $native)) {
             return $value;
         }
     }
     // check whether datestyle setting changed
     if ($this->_connection && $this->_style !== ($style = pg_parameter_status($this->_connection, 'DateStyle'))) {
         $this->_style = $style;
         foreach ($this->getFormats($this->_style) as $format) {
             if ($value = \DateTime::createFromFormat('!' . $format, $native)) {
                 return $value;
             }
         }
     }
     throw TypeConversionException::unexpectedValue($this, 'input', $this->expectation, $native);
 }
开发者ID:sad-spirit,项目名称:pg-wrapper,代码行数:18,代码来源:BaseDateTimeConverter.php


示例13: setConnectionResource

 public function setConnectionResource($resource)
 {
     $this->_connection = $resource;
     // if connection was made to PostgreSQL 9.0+, then use 'hex' encoding
     $this->useHexEncoding(version_compare(pg_parameter_status($resource, 'server_version'), '9.0.0', '>='));
 }
开发者ID:sad-spirit,项目名称:pg-wrapper,代码行数:6,代码来源:ByteaConverter.php


示例14: getVersion

 public function getVersion()
 {
     return @pg_parameter_status($this->_hMaster, 'server_version');
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:4,代码来源:postgres.class.php


示例15: db_version

 public function db_version($handle)
 {
     if (is_resource($handle)) {
         return pg_parameter_status($handle, 'server_version');
     }
     return null;
 }
开发者ID:archcidburnziso,项目名称:Bilboplanet,代码行数:7,代码来源:class.pgsql.php


示例16: _doConnect

 /**
  * Do the grunt work of connecting to the database
  *
  * @return mixed connection resource on success, MDB2 Error Object on failure
  * @access protected
  */
 function _doConnect($username, $password, $database_name, $persistent = false)
 {
     if (!PEAR::loadExtension($this->phptype)) {
         return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'extension ' . $this->phptype . ' is not compiled into PHP', __FUNCTION__);
     }
     if ($database_name == '') {
         $database_name = 'template1';
     }
     $protocol = $this->dsn['protocol'] ? $this->dsn['protocol'] : 'tcp';
     $params = array('');
     if ($protocol == 'tcp') {
         if ($this->dsn['hostspec']) {
             $params[0] .= 'host=' . $this->dsn['hostspec'];
         }
         if ($this->dsn['port']) {
             $params[0] .= ' port=' . $this->dsn['port'];
         }
     } elseif ($protocol == 'unix') {
         // Allow for pg socket in non-standard locations.
         if ($this->dsn['socket']) {
             $params[0] .= 'host=' . $this->dsn['socket'];
         }
         if ($this->dsn['port']) {
             $params[0] .= ' port=' . $this->dsn['port'];
         }
     }
     if ($database_name) {
         $params[0] .= ' dbname=\'' . addslashes($database_name) . '\'';
     }
     if ($username) {
         $params[0] .= ' user=\'' . addslashes($username) . '\'';
     }
     if ($password) {
         $params[0] .= ' password=\'' . addslashes($password) . '\'';
     }
     if (!empty($this->dsn['options'])) {
         $params[0] .= ' options=' . $this->dsn['options'];
     }
     if (!empty($this->dsn['tty'])) {
         $params[0] .= ' tty=' . $this->dsn['tty'];
     }
     if (!empty($this->dsn['connect_timeout'])) {
         $params[0] .= ' connect_timeout=' . $this->dsn['connect_timeout'];
     }
     if (!empty($this->dsn['sslmode'])) {
         $params[0] .= ' sslmode=' . $this->dsn['sslmode'];
     }
     if (!empty($this->dsn['service'])) {
         $params[0] .= ' service=' . $this->dsn['service'];
     }
     if ($this->_isNewLinkSet()) {
         if (version_compare(phpversion(), '4.3.0', '>=')) {
             $params[] = PGSQL_CONNECT_FORCE_NEW;
         }
     }
     $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
     $connection = @call_user_func_array($connect_function, $params);
     if (!$connection) {
         return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null, 'unable to establish a connection', __FUNCTION__);
     }
     if (empty($this->dsn['disable_iso_date'])) {
         if (!@pg_query($connection, "SET SESSION DATESTYLE = 'ISO'")) {
             return $this->raiseError(null, null, null, 'Unable to set date style to iso', __FUNCTION__);
         }
     }
     if (!empty($this->dsn['charset'])) {
         $result = $this->setCharset($this->dsn['charset'], $connection);
         if (PEAR::isError($result)) {
             return $result;
         }
     }
     // Enable extra compatibility settings on 8.2 and later
     if (function_exists('pg_parameter_status')) {
         $version = pg_parameter_status($connection, 'server_version');
         if ($version == false) {
             return $this->raiseError(null, null, null, 'Unable to retrieve server version', __FUNCTION__);
         }
         $version = explode('.', $version);
         if ($version['0'] > 8 || $version['0'] == 8 && $version['1'] >= 2) {
             if (!@pg_query($connection, "SET SESSION STANDARD_CONFORMING_STRINGS = OFF")) {
                 return $this->raiseError(null, null, null, 'Unable to set standard_conforming_strings to off', __FUNCTION__);
             }
             if (!@pg_query($connection, "SET SESSION ESCAPE_STRING_WARNING = OFF")) {
                 return $this->raiseError(null, null, null, 'Unable to set escape_string_warning to off', __FUNCTION__);
             }
         }
     }
     return $connection;
 }
开发者ID:phpontrax,项目名称:trax,代码行数:95,代码来源:pgsql.php


示例17: getTables

 /**
  * Returns list of tables.
  * @return array
  */
 public function getTables()
 {
     $version = pg_parameter_status($this->resource, 'server_version');
     if ($version < 7.4) {
         throw new DibiDriverException('Reflection requires PostgreSQL 7.4 and newer.');
     }
     $res = $this->query("\r\n\t\t\tSELECT\r\n\t\t\t\ttable_name AS name,\r\n\t\t\t\tCASE table_type\r\n\t\t\t\t\tWHEN 'VIEW' THEN 1\r\n\t\t\t\t\tELSE 0\r\n\t\t\t\tEND AS view\r\n\t\t\tFROM\r\n\t\t\t\tinformation_schema.tables\r\n\t\t\tWHERE\r\n\t\t\t\ttable_schema = current_schema()\r\n\t\t");
     $tables = pg_fetch_all($res->resultSet);
     return $tables ? $tables : array();
 }
开发者ID:besir,项目名称:besir.cz,代码行数:14,代码来源:DibiPostgreDriver.php


示例18: DBconnect

/**
 * Creates global database connection.
 *
 * @param string $error returns a message in case of an error
 * @param bool   $debug turns On or Off trace calls when making connections. Suggested debug mode Off during Zabbix setup
 *
 * @return bool
 */
function DBconnect(&$error)
{
    global $DB;
    if (isset($DB['DB'])) {
        $error = _('Cannot create another database connection.');
        return false;
    }
    $result = true;
    $DB['DB'] = null;
    // global db handler
    $DB['TRANSACTIONS'] = 0;
    // level of a nested transation
    $DB['TRANSACTION_NO_FAILED_SQLS'] = true;
    // true - if no statements failed in transaction, false - there are failed statements
    $DB['SELECT_COUNT'] = 0;
    // stats
    $DB['EXECUTE_COUNT'] = 0;
    if (!isset($DB['TYPE'])) {
        $error = 'Unknown database type.';
        $result = false;
    } else {
        $DB['TYPE'] = strtoupper($DB['TYPE']);
        switch ($DB['TYPE']) {
            case ZBX_DB_MYSQL:
                $DB['DB'] = @mysqli_connect($DB['SERVER'], $DB['USER'], $DB['PASSWORD'], $DB['DATABASE'], $DB['PORT']);
                if (!$DB['DB']) {
                    $error = 'Error connecting to database: ' . trim(mysqli_connect_error());
                    $result = false;
                } else {
                    DBexecute('SET NAMES utf8');
                }
                if ($result) {
                    $dbBackend = new MysqlDbBackend();
                }
                break;
            case ZBX_DB_POSTGRESQL:
                $pg_connection_string = (!empty($DB['SERVER']) ? 'host=\'' . pg_connect_escape($DB['SERVER']) . '\' ' : '') . 'dbname=\'' . pg_connect_escape($DB['DATABASE']) . '\' ' . (!empty($DB['USER']) ? 'user=\'' . pg_connect_escape($DB['USER']) . '\' ' : '') . (!empty($DB['PASSWORD']) ? 'password=\'' . pg_connect_escape($DB['PASSWORD']) . '\' ' : '') . (!empty($DB['PORT']) ? 'port=' . pg_connect_escape($DB['PORT']) : '');
                $DB['DB'] = @pg_connect($pg_connection_string);
                if (!$DB['DB']) {
                    $error = 'Error connecting to database.';
                    $result = false;
                } else {
                    $schemaSet = DBexecute('SET search_path = ' . zbx_dbstr($DB['SCHEMA'] ? $DB['SCHEMA'] : 'public'), true);
                    if (!$schemaSet) {
                        clear_messages();
                        $error = pg_last_error();
                        $result = false;
                    } else {
                        if (false !== ($pgsql_version = pg_parameter_status('server_version'))) {
                            if ((int) $pgsql_version >= 9) {
                                // change the output format for values of type bytea from hex (the default) to escape
                                DBexecute('SET bytea_output = escape');
                            }
                        }
                    }
                }
                if ($result) {
                    $dbBackend = new PostgresqlDbBackend();
                }
                break;
            case ZBX_DB_ORACLE:
                $connect = '';
                if (!empty($DB['SERVER'])) {
                    $connect = '//' . $DB['SERVER'];
                    if ($DB['PORT'] != '0') {
                        $connect .= ':' . $DB['PORT'];
                    }
                    if ($DB['DATABASE']) {
                        $connect .= '/' . $DB['DATABASE'];
                    }
                }
                $DB['DB'] = @oci_connect($DB['USER'], $DB['PASSWORD'], $connect);
                if ($DB['DB']) {
                    DBexecute('ALTER SESSION SET NLS_NUMERIC_CHARACTERS=' . zbx_dbstr('. '));
                } else {
                    $ociError = oci_error();
                    $error = 'Error connecting to database: ' . $ociError['message'];
                    $result = false;
                }
                if ($result) {
                    $dbBackend = new OracleDbBackend();
                }
                break;
            case ZBX_DB_DB2:
                $connect = '';
                $connect .= 'DATABASE=' . $DB['DATABASE'] . ';';
                $connect .= 'HOSTNAME=' . $DB['SERVER'] . ';';
                $connect .= 'PORT=' . $DB['PORT'] . ';';
                $connect .= 'PROTOCOL=TCPIP;';
                $connect .= 'UID=' . $DB['USER'] . ';';
                $connect .= 'PWD=' . $DB['PASSWORD'] . ';';
                $DB['DB'] = @db2_connect($connect, $DB['USER'], $DB['PASSWORD']);
//.........这里部分代码省略.........
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:101,代码来源:db.inc.php


示例19: getAttribute

 public function getAttribute($attribute)
 {
     switch ($attribute) {
         case DoLite::ATTR_SERVER_INFO:
             return pg_parameter_status($this->_connection, 'server_encoding');
             break;
         case DoLite::ATTR_SERVER_VERSION:
             return pg_parameter_status($this->_connection, 'server_version');
             break;
         case DoLite::ATTR_CLIENT_VERSION:
             return pg_parameter_status($this->_connection, 'server_version') . ' ' . pg_parameter_status($this->_connection, 'client_encoding');
             break;
         case DoLite::ATTR_PERSISTENT:
             return $this->_persistent;
             break;
     }
     return null;
 }
开发者ID:chaobj001,项目名称:tt,代码行数:18,代码来源:DoPgsql.php


示例20: pg_connect

<?php

// @[email protected]
include 'config/db.php';
// attempt a connection
$dbh = pg_connect("host={$hostname_DB} dbname=postgres user={$username_DB} password={$password_DB}");
if (!$dbh) {
    die("Error in connection: " . pg_last_error());
}
// get value of 'server_version' variable
echo "Server version: " . pg_parameter_status($dbh, 'server_version');
开发者ID:ravibhure,项目名称:myapp,代码行数:11,代码来源:pgversion.php



注:本文中的pg_parameter_status函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pg_pconnect函数代码示例发布时间:2022-05-15
下一篇:
PHP pg_numrows函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap