pg_query example



    /** * Executes the query against the database. * * @return false|resource * @phpstan-return false|PgSqlResult */
    protected function execute(string $sql)
    {
        try {
            return pg_query($this->connID, $sql);
        } catch (ErrorException $e) {
            log_message('error', (string) $e);

            if ($this->DBDebug) {
                throw new DatabaseException($e->getMessage()$e->getCode()$e);
            }
        }

        return false;
    }

    

    public function _getResult()
    {
        return $this->result;
    }

    /** * Deallocate prepared statements. */
    protected function _close(): bool
    {
        return pg_query($this->db->connID, 'DEALLOCATE "' . $this->db->escapeIdentifiers($this->name) . '"') !== false;
    }

    /** * Replaces the ? placeholders with $1, $2, etc parameters for use * within the prepared query. */
    public function parameterize(string $sql): string
    {
        // Track our current value         $count = 0;

        
Home | Imprint | This part of the site doesn't use cookies.