function pg_connection_status()

in pgsql/pgsql.php [130:331]


function pg_connection_status(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection): int {}

/**
 * Get connection is busy or not
 * @link https://php.net/manual/en/function.pg-connection-busy.php
 * @param resource $connection <p>
 * PostgreSQL database connection resource.
 * </p>
 * @return bool <b>TRUE</b> if the connection is busy, <b>FALSE</b> otherwise.
 */
function pg_connection_busy(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection): bool {}

/**
 * Reset connection (reconnect)
 * @link https://php.net/manual/en/function.pg-connection-reset.php
 * @param resource $connection <p>
 * PostgreSQL database connection resource.
 * </p>
 * @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
 */
function pg_connection_reset(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection): bool {}

/**
 * Get a read only handle to the socket underlying a PostgreSQL connection
 * @link https://php.net/manual/en/function.pg-socket.php
 * @param resource $connection <p>
 * PostgreSQL database connection resource.
 * </p>
 * @return resource|false A socket resource on success or <b>FALSE</b> on failure.
 * @since 5.6
 */
function pg_socket(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection) {}

/**
 * Returns the host name associated with the connection
 * @link https://php.net/manual/en/function.pg-host.php
 * @param resource $connection [optional] <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @return string|false A string containing the name of the host the
 * <i>connection</i> is to, or <b>FALSE</b> on error.
 */
function pg_host(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection|null'], default: 'resource')] $connection = null): string {}

/**
 * Get the database name
 * @link https://php.net/manual/en/function.pg-dbname.php
 * @param resource $connection [optional] <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @return string|false A string containing the name of the database the
 * <i>connection</i> is to, or <b>FALSE</b> on error.
 */
function pg_dbname(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection|null'], default: 'resource')] $connection = null): string {}

/**
 * Return the port number associated with the connection
 * @link https://php.net/manual/en/function.pg-port.php
 * @param resource $connection [optional] <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @return string A string containing the port number of the database server the connection is to, or empty string on error.
 */
function pg_port(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection|null'], default: 'resource')] $connection = null): string {}

/**
 * Return the TTY name associated with the connection
 * @link https://php.net/manual/en/function.pg-tty.php
 * @param resource $connection [optional] <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @return string A string containing the debug TTY of
 * the <i>connection</i>, or <b>FALSE</b> on error.
 */
function pg_tty(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection|null'], default: 'resource')] $connection = null): string {}

/**
 * Get the options associated with the connection
 * @link https://php.net/manual/en/function.pg-options.php
 * @param resource $connection [optional] <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @return string A string containing the <i>connection</i>
 * options, or <b>FALSE</b> on error.
 */
function pg_options(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection|null'], default: 'resource')] $connection = null): string {}

/**
 * Returns an array with client, protocol and server version (when available)
 * @link https://php.net/manual/en/function.pg-version.php
 * @param resource $connection [optional] <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @return array an array with client, protocol
 * and server keys and values (if available). Returns
 * <b>FALSE</b> on error or invalid connection.
 */
#[ArrayShape(["client" => "string", "protocol" => "int", "server" => "string"])]
function pg_version(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection|null'], default: 'resource')] $connection = null): array {}

/**
 * Ping database connection
 * @link https://php.net/manual/en/function.pg-ping.php
 * @param resource $connection [optional] <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
 */
function pg_ping(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection|null'], default: 'resource')] $connection = null): bool {}

/**
 * Looks up a current parameter setting of the server.
 * @link https://php.net/manual/en/function.pg-parameter-status.php
 * @param resource $connection <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @param string $name [optional] <p>
 * Possible <i>param_name</i> values include server_version,
 * server_encoding, client_encoding,
 * is_superuser, session_authorization,
 * DateStyle, TimeZone, and
 * integer_datetimes.
 * </p>
 * @return string|false A string containing the value of the parameter, <b>FALSE</b> on failure or invalid
 * <i>param_name</i>.
 */
function pg_parameter_status(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection, string $name): string|false {}

/**
 * Returns the current in-transaction status of the server.
 * @link https://php.net/manual/en/function.pg-transaction-status.php
 * @param resource $connection <p>
 * PostgreSQL database connection resource.
 * </p>
 * @return int The status can be <b>PGSQL_TRANSACTION_IDLE</b> (currently idle),
 * <b>PGSQL_TRANSACTION_ACTIVE</b> (a command is in progress),
 * <b>PGSQL_TRANSACTION_INTRANS</b> (idle, in a valid transaction block),
 * or <b>PGSQL_TRANSACTION_INERROR</b> (idle, in a failed transaction block).
 * <b>PGSQL_TRANSACTION_UNKNOWN</b> is reported if the connection is bad.
 * <b>PGSQL_TRANSACTION_ACTIVE</b> is reported only when a query
 * has been sent to the server and not yet completed.
 */
function pg_transaction_status(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection): int {}

/**
 * Execute a query
 * @link https://php.net/manual/en/function.pg-query.php
 * @param resource $connection <p>
 * PostgreSQL database connection resource. When
 * <i>connection</i> is not present, the default connection
 * is used. The default connection is the last connection made by
 * <b>pg_connect</b> or <b>pg_pconnect</b>.
 * </p>
 * @param string $query [optional] <p>
 * The SQL statement or statements to be executed. When multiple statements are passed to the function,
 * they are automatically executed as one transaction, unless there are explicit BEGIN/COMMIT commands
 * included in the query string. However, using multiple transactions in one function call is not recommended.
 * </p>
 * <p>
 * String interpolation of user-supplied data is extremely dangerous and is
 * likely to lead to SQL
 * injection vulnerabilities. In most cases
 * <b>pg_query_params</b> should be preferred, passing
 * user-supplied values as parameters rather than substituting them into
 * the query string.
 * </p>
 * <p>
 * Any user-supplied data substituted directly into a query string should
 * be properly escaped.
 * </p>
 * @return resource|false A query result resource on success or <b>FALSE</b> on failure.
 */
#[LanguageLevelTypeAware(['8.1' => 'PgSql\Result|false'], default: 'resource|false')]
function pg_query(
    #[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] $connection = null,
    #[PhpStormStubsElementAvailable(from: '8.0')] #[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection,
    string $query
) {}