summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_pgsql')
-rw-r--r--ext/pdo_pgsql/CREDITS2
-rw-r--r--ext/pdo_pgsql/config.m4101
-rw-r--r--ext/pdo_pgsql/config.w3216
-rw-r--r--ext/pdo_pgsql/package.xml53
-rw-r--r--ext/pdo_pgsql/pdo_pgsql.c113
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c345
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c157
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql.h58
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql_int.h80
9 files changed, 0 insertions, 925 deletions
diff --git a/ext/pdo_pgsql/CREDITS b/ext/pdo_pgsql/CREDITS
deleted file mode 100644
index bbb7b94428..0000000000
--- a/ext/pdo_pgsql/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-PostgreSQL driver for PDO
-Edin Kadribasic, Ilia Alshanetsky
diff --git a/ext/pdo_pgsql/config.m4 b/ext/pdo_pgsql/config.m4
deleted file mode 100644
index 66b4949bea..0000000000
--- a/ext/pdo_pgsql/config.m4
+++ /dev/null
@@ -1,101 +0,0 @@
-dnl
-dnl $Id$
-dnl
-
-AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[
-])
-
-PHP_ARG_WITH(pdo-pgsql,for PostgreSQL support for PDO,
-[ --with-pdo-pgsql[=DIR] Include PDO PostgreSQL support. DIR
- is the PostgreSQL base install directory
- or the path to pg_config.])
-
-if test "$PHP_PDO_PGSQL" != "no"; then
- PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE)
-
- AC_MSG_CHECKING(for pg_config)
- for i in $PHP_PDO_PGSQL $PHP_PDO_PGSQL/bin /usr/local/pgsql/bin /usr/local/bin /usr/bin ""; do
- if test -x $i/pg_config; then
- PG_CONFIG="$i/pg_config"
- break;
- fi
- done
-
- if test -n "$PG_CONFIG"; then
- AC_MSG_RESULT([$PG_CONFIG])
- PGSQL_INCLUDE=`$PG_CONFIG --includedir`
- PGSQL_LIBDIR=`$PG_CONFIG --libdir`
- AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h])
- else
- AC_MSG_RESULT(not found)
- if test "$PHP_PDO_PGSQL" = "yes"; then
- PGSQL_SEARCH_PATHS="/usr /usr/local /usr/local/pgsql"
- else
- PGSQL_SEARCH_PATHS=$PHP_PDO_PGSQL
- fi
-
- for i in $PGSQL_SEARCH_PATHS; do
- for j in include include/pgsql include/postgres include/postgresql ""; do
- if test -r "$i/$j/libpq-fe.h"; then
- PGSQL_INC_BASE=$i
- PGSQL_INCLUDE=$i/$j
- if test -r "$i/$j/pg_config.h"; then
- AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h])
- fi
- fi
- done
-
- for j in lib lib/pgsql lib/postgres lib/postgresql ""; do
- if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
- PGSQL_LIBDIR=$i/$j
- fi
- done
- done
- fi
-
- if test -z "$PGSQL_INCLUDE"; then
- AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path)
- fi
-
- if test -z "$PGSQL_LIBDIR"; then
- AC_MSG_ERROR(Cannot find libpq.so. Please specify correct PostgreSQL installation path)
- fi
-
- if test -z "$PGSQL_INCLUDE" -a -z "$PGSQL_LIBDIR" ; then
- AC_MSG_ERROR([Unable to find libpq anywhere under $withval])
- fi
-
- AC_DEFINE(HAVE_PDO_PGSQL,1,[Whether to build PostgreSQL for PDO support or not])
- old_LIBS=$LIBS
- old_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR"
- AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 or later]))
- AC_CHECK_LIB(pq, PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later]))
- AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq under windows]))
- AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL]))
- AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later]))
- AC_CHECK_LIB(pq, PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later]))
- AC_CHECK_LIB(pq, PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later]))
- AC_CHECK_LIB(pq, PQtransactionStatus,AC_DEFINE(HAVE_PGTRANSACTIONSTATUS,1,[PostgreSQL 7.4 or later]))
- AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibye]))
- LIBS=$old_LIBS
- LDFLAGS=$old_LDFLAGS
-
- PHP_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR, PDO_PGSQL_SHARED_LIBADD)
- PHP_SUBST(PDO_PGSQL_SHARED_LIBADD)
-
- PHP_ADD_INCLUDE($PGSQL_INCLUDE)
-
-dnl find PDO sources
- if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
- pdo_inc_path=$prefix/include/php/ext
- elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
- pdo_inc_path=$abs_srcdir/ext
- elif test -f ext/pdo/php_pdo_driver.h; then
- pdo_inc_path=ext
- else
- AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
- fi
-
- PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared,,-I$pdo_inc_path)
-fi
diff --git a/ext/pdo_pgsql/config.w32 b/ext/pdo_pgsql/config.w32
deleted file mode 100644
index eaa232dfc9..0000000000
--- a/ext/pdo_pgsql/config.w32
+++ /dev/null
@@ -1,16 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_WITH("pdo-pgsql", "PostgreSQL support for PDO", "no");
-
-if (PHP_PDO_PGSQL != "no") {
- if (CHECK_LIB("libpq.lib", "pdo_pgsql", PHP_PDO_PGSQL) &&
- CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PDO_PGSQL", PHP_PDO_PGSQL + ";" + PHP_PHP_BUILD + "\\include\\pgsql")) {
- EXTENSION("pdo_pgsql", "pdo_pgsql.c pgsql_driver.c pgsql_statement.c");
- ADD_FLAG('CFLAGS_PDO_PGSQL', "/I ..\\pecl");
- AC_DEFINE('HAVE_PDO_PGSQL', 1, 'Have PostgreSQL library');
- } else {
- WARNING("pdo_pgsql not enabled; libraries and headers not found");
- }
- ADD_EXTENSION_DEP('pdo_pgsql', 'pdo');
-}
diff --git a/ext/pdo_pgsql/package.xml b/ext/pdo_pgsql/package.xml
deleted file mode 100644
index 290f66bdbf..0000000000
--- a/ext/pdo_pgsql/package.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE package SYSTEM "../pear/package.dtd">
-<package version="1.0">
- <name>PDO_PGSQL</name>
- <summary>PostgreSQL driver for PDO</summary>
- <maintainers>
- <maintainer>
- <user>edink</user>
- <name>Edin Kadribasic</name>
- <email>edink@php.net</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>iliaa</user>
- <name>Ilia Alshanetsky</name>
- <email>iliaa@php.net</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <description>
- This extension provides an PostgreSQL driver for PDO.
- </description>
- <license>PHP</license>
- <release>
- <state>alpha</state>
- <version>0.1</version>
- <date>2004-05-21</date>
-
- <notes>
- You need to install the PDO core module before you can make use of this one.
- You also require PostgreSQL client libraries installed on the machine where you intend to build and/or use it.
-
- If you are running on windows, you can download the binary from here:
- http://snaps.php.net/win32/PECL_5_0/php_pdo_pgsql.dll
- </notes>
-
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="config.w32"/>
- <file role="src" name="pdo_pgsql.c"/>
- <file role="src" name="pgsql_driver.c"/>
- <file role="src" name="pgsql_statement.c"/>
- <file role="src" name="php_pdo_pgsql.h"/>
- <file role="src" name="php_pdo_pgsql_int.h"/>
-
- <file role="doc" name="CREDITS"/>
- </filelist>
- <deps>
- <dep type="php" rel="ge" version="5.0.0RC3dev"/>
- <dep type="ext" rel="ge" name="pdo" version="0.1"/>
- </deps>
- </release>
-</package>
diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c
deleted file mode 100644
index f6c4616e7a..0000000000
--- a/ext/pdo_pgsql/pdo_pgsql.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@emini.dk> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "pdo/php_pdo.h"
-#include "pdo/php_pdo_driver.h"
-#include "php_pdo_pgsql.h"
-#include "php_pdo_pgsql_int.h"
-
-/* {{{ pdo_pgsql_functions[] */
-function_entry pdo_pgsql_functions[] = {
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ pdo_pgsql_module_entry */
-zend_module_entry pdo_pgsql_module_entry = {
- STANDARD_MODULE_HEADER,
- "pdo_pgsql",
- pdo_pgsql_functions,
- PHP_MINIT(pdo_pgsql),
- PHP_MSHUTDOWN(pdo_pgsql),
- PHP_RINIT(pdo_pgsql),
- PHP_RSHUTDOWN(pdo_pgsql),
- PHP_MINFO(pdo_pgsql),
- "0.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_PDO_PGSQL
-ZEND_GET_MODULE(pdo_pgsql)
-#endif
-
-/* true global environment */
-
-/* {{{ PHP_MINIT_FUNCTION
- */
-PHP_MINIT_FUNCTION(pdo_pgsql)
-{
- php_pdo_register_driver(&pdo_pgsql_driver);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_MSHUTDOWN_FUNCTION(pdo_pgsql)
-{
- php_pdo_unregister_driver(&pdo_pgsql_driver);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION
- */
-PHP_RINIT_FUNCTION(pdo_pgsql)
-{
- // php_pdo_register_driver(&pdo_pgsql_driver);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-PHP_RSHUTDOWN_FUNCTION(pdo_pgsql)
-{
- // php_pdo_unregister_driver(&pdo_pgsql_driver);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(pdo_pgsql)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "PDO Driver for PostgreSQL", "enabled");
- php_info_print_table_end();
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
deleted file mode 100644
index 063c34ed61..0000000000
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@emini.dk> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "pdo/php_pdo.h"
-#include "pdo/php_pdo_driver.h"
-
-#include "pg_config.h" /* needed for PG_VERSION */
-#include "php_pdo_pgsql.h"
-#include "php_pdo_pgsql_int.h"
-
-int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *file, int line TSRMLS_DC) /* {{{ */
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
- enum pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code;
- pdo_pgsql_error_info *einfo = &H->einfo;
- char *errmsg = PQerrorMessage(H->server);
-
- einfo->errcode = errcode;
- einfo->file = file;
- einfo->line = line;
-
- if (einfo->errmsg) {
- efree(einfo->errmsg);
- einfo->errmsg = NULL;
- }
-
- switch (errcode) {
- case PGRES_EMPTY_QUERY:
- *pdo_err = PDO_ERR_SYNTAX;
- break;
-
- default:
- *pdo_err = PDO_ERR_CANT_MAP;
- break;
- }
-
- if (errmsg) {
- einfo->errmsg = estrdup(errmsg);
- }
-
- return errcode;
-}
-/* }}} */
-
-static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC) /* {{{ */
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
- pdo_pgsql_error_info *einfo = &H->einfo;
-
- if (einfo->errcode) {
- add_next_index_long(info, einfo->errcode);
- add_next_index_string(info, einfo->errmsg, 1);
- }
-
- return 1;
-}
-/* }}} */
-
-static int pgsql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
- if (H) {
- if (H->server) {
- PQfinish(H->server);
- H->server = NULL;
- }
- if (H->einfo.errmsg) {
- efree(H->einfo.errmsg);
- H->einfo.errmsg = NULL;
- }
- pefree(H, dbh->is_persistent);
- H = NULL;
- }
- return 0;
-}
-/* }}} */
-
-static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC)
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
- pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt));
-
- S->H = H;
- stmt->driver_data = S;
- stmt->methods = &pgsql_stmt_methods;
-
- return 1;
-}
-
-static long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC)
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
- PGresult *res;
-
- if (!(res = PQexec(H->server, sql))) {
- /* fatal error */
- pdo_pgsql_error(dbh, PGRES_FATAL_ERROR);
- return 0;
- } else {
- ExecStatusType qs = PQresultStatus(res);
- if (qs != PGRES_COMMAND_OK && qs != PGRES_TUPLES_OK) {
- pdo_pgsql_error(dbh, qs);
- PQclear(res);
- return 0;
- }
- H->pgoid = PQoidValue(res);
- PQclear(res);
- }
-
- return 1;
-}
-
-static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen TSRMLS_DC)
-{
- unsigned char *escaped;
-
- /* escapedlen returned by PQescapeBytea() accounts for trailing 0 */
- escaped = PQescapeBytea(unquoted, unquotedlen, quotedlen);
- *quotedlen += 1;
- *quoted = emalloc(*quotedlen + 1);
- memcpy((*quoted)+1, escaped, *quotedlen-2);
- (*quoted)[0] = '\'';
- (*quoted)[*quotedlen-1] = '\'';
- (*quoted)[*quotedlen] = '\0';
- free(escaped);
-
- return 1;
-}
-
-static long pdo_pgsql_last_insert_id(pdo_dbh_t *dbh TSRMLS_DC)
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
-
- if (H->pgoid == InvalidOid) {
- return -1;
- }
-
- return (long) H->pgoid;
-}
-
-static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC)
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
-
- switch (attr) {
- case PDO_ATTR_CLIENT_VERSION:
- ZVAL_STRING(return_value, PG_VERSION, 1);
- break;
-
- case PDO_ATTR_SERVER_VERSION:
-#ifdef HAVE_PQPROTOCOLVERSION
- if (PQprotocolVersion(H->server) >= 3) { /* PostgreSQL 7.4 or later */
- ZVAL_STRING(return_value, (char*)PQparameterStatus(H->server, "server_version"), 1);
- } else /* emulate above via a query */
-#endif
- {
- PGresult *res = PQexec(H->server, "SELECT VERSION()");
- if (res && PQresultStatus(res) == PGRES_TUPLES_OK) {
- ZVAL_STRING(return_value, (char *)PQgetvalue(res, 0, 0), 1);
- }
-
- if (res) {
- PQclear(res);
- }
- }
- break;
-
- case PDO_ATTR_CONNECTION_STATUS:
- switch (PQstatus(H->server)) {
- case CONNECTION_STARTED:
- ZVAL_STRINGL(return_value, "Waiting for connection to be made.", sizeof("Waiting for connection to be made.")-1, 1);
- break;
-
- case CONNECTION_MADE:
- case CONNECTION_OK:
- ZVAL_STRINGL(return_value, "Connection OK; waiting to send.", sizeof("Connection OK; waiting to send.")-1, 1);
- break;
-
- case CONNECTION_AWAITING_RESPONSE:
- ZVAL_STRINGL(return_value, "Waiting for a response from the server.", sizeof("Waiting for a response from the server.")-1, 1);
- break;
-
- case CONNECTION_AUTH_OK:
- ZVAL_STRINGL(return_value, "Received authentication; waiting for backend start-up to finish.", sizeof("Received authentication; waiting for backend start-up to finish.")-1, 1);
- break;
-#ifdef CONNECTION_SSL_STARTUP
- case CONNECTION_SSL_STARTUP:
- ZVAL_STRINGL(return_value, "Negotiating SSL encryption.", sizeof("Negotiating SSL encryption.")-1, 1);
- break;
-#endif
- case CONNECTION_SETENV:
- ZVAL_STRINGL(return_value, "Negotiating environment-driven parameter settings.", sizeof("Negotiating environment-driven parameter settings.")-1, 1);
- break;
-
- case CONNECTION_BAD:
- default:
- ZVAL_STRINGL(return_value, "Bad connection.", sizeof("Bad connection.")-1, 1);
- break;
- }
- break;
-
- case PDO_ATTR_SERVER_INFO: {
- int spid = PQbackendPID(H->server);
- char *tmp;
-#ifdef HAVE_PQPROTOCOLVERSION
- spprintf(&tmp, 0,
- "PID: %d; Client Encoding: %s; Is Superuser: %s; Session Authorization: %s; Date Style: %s",
- spid,
- (char*)PQparameterStatus(H->server, "client_encoding"),
- (char*)PQparameterStatus(H->server, "is_superuser"),
- (char*)PQparameterStatus(H->server, "session_authorization"),
- (char*)PQparameterStatus(H->server, "DateStyle"));
-#else
- spprintf(&tmp, 0, "PID: %d", spid);
-#endif
- ZVAL_STRING(return_value, tmp, 0);
- }
- break;
-
- default:
- return 0;
- }
-
- return 1;
-}
-
-static int pdo_pgsql_transaction_cmd(const char *cmd, pdo_dbh_t *dbh TSRMLS_DC)
-{
- pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
- PGresult *res;
- int ret = 1;
-
- res = PQexec(H->server, cmd);
-
- if (PQresultStatus(res) != PGRES_COMMAND_OK) {
- ret = 0;
- }
-
- PQclear(res);
- return ret;
-}
-
-static int pgsql_handle_begin(pdo_dbh_t *dbh TSRMLS_DC)
-{
- return pdo_pgsql_transaction_cmd("BEGIN", dbh TSRMLS_CC);
-}
-
-static int pgsql_handle_commit(pdo_dbh_t *dbh TSRMLS_DC)
-{
- return pdo_pgsql_transaction_cmd("COMMIT", dbh TSRMLS_CC);
-}
-
-static int pgsql_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
-{
- return pdo_pgsql_transaction_cmd("ROLLBACK", dbh TSRMLS_CC);
-}
-
-static struct pdo_dbh_methods pgsql_methods = {
- pgsql_handle_closer,
- pgsql_handle_preparer,
- pgsql_handle_doer,
- pgsql_handle_quoter,
- pgsql_handle_begin,
- pgsql_handle_commit,
- pgsql_handle_rollback,
- NULL,
- pdo_pgsql_last_insert_id,
- pdo_pgsql_fetch_error_func,
- pdo_pgsql_get_attribute
-};
-
-static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */
-{
- pdo_pgsql_db_handle *H;
- int ret = 0;
-
- H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent);
- dbh->driver_data = H;
-
- H->einfo.errcode = 0;
- H->einfo.errmsg = NULL;
-
- H->server = PQconnectdb(dbh->data_source);
-
- if (PQstatus(H->server) != CONNECTION_OK) {
- pdo_pgsql_error(dbh, PGRES_FATAL_ERROR);
- goto cleanup;
- }
-
- H->attached = 1;
- H->pgoid = -1;
-
- dbh->methods = &pgsql_methods;
- dbh->alloc_own_columns = 1;
- dbh->supports_placeholders = PDO_PLACEHOLDER_NONE;
- dbh->max_escaped_char_length = 2;
-
- ret = 1;
-
-cleanup:
- if (!ret) {
- pgsql_handle_closer(dbh TSRMLS_CC);
- }
-
- return ret;
-}
-/* }}} */
-
-pdo_driver_t pdo_pgsql_driver = {
- PDO_DRIVER_HEADER(pgsql),
- pdo_pgsql_handle_factory
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
deleted file mode 100644
index 8808e91ef7..0000000000
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@emini.dk> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "pdo/php_pdo.h"
-#include "pdo/php_pdo_driver.h"
-#include "php_pdo_pgsql.h"
-#include "php_pdo_pgsql_int.h"
-
-
-static int pgsql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
-{
- pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
- int i;
-
- if (S->result) {
- /* free the resource */
- PQclear(S->result);
- S->result = NULL;
- }
- if(S->cols) {
- efree(S->cols);
- S->cols = NULL;
- }
- efree(S);
- return 1;
-}
-
-static int pgsql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
-{
- pdo_dbh_t *dbh = stmt->dbh;
- pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
- pdo_pgsql_db_handle *H = S->H;
- ExecStatusType status;
-
- if (stmt->executed) {
- /* ensure that we free any previous unfetched results */
- if(S->result) {
- PQclear(S->result);
- S->result = NULL;
- }
- }
-
- S->result = PQexec(H->server, stmt->active_query_string);
- status = PQresultStatus(S->result);
-
- if (status != PGRES_COMMAND_OK && status != PGRES_TUPLES_OK) {
- pdo_pgsql_error_stmt(stmt, status);
- return 0;
- }
-
- if(!stmt->executed) {
- stmt->column_count = (int) PQnfields(S->result);
- S->cols = ecalloc(stmt->column_count, sizeof(pdo_pgsql_column));
- }
-
-
- if (status == PGRES_COMMAND_OK) {
- stmt->row_count = (long)atoi(PQcmdTuples(S->result));
- } else {
- stmt->row_count = (long)PQntuples(S->result);
- }
-
- return 1;
-}
-
-static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *param,
- enum pdo_param_event event_type TSRMLS_DC)
-{
- return 1;
-}
-
-static int pgsql_stmt_fetch(pdo_stmt_t *stmt TSRMLS_DC)
-{
- pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
-
- if (S->current_row < stmt->row_count) {
- S->current_row++;
- return 1;
- } else {
- return 0;
- }
-}
-
-static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
-{
- pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
- struct pdo_column_data *cols = stmt->columns;
-
- if (!S->result) {
- return 0;
- }
-
- cols[colno].name = estrdup(PQfname(S->result, colno));
- cols[colno].namelen = strlen(cols[colno].name);
- cols[colno].maxlen = PQfsize(S->result, colno);
- cols[colno].precision = PQfmod(S->result, colno);
- cols[colno].param_type = PDO_PARAM_STR;
-
- return 1;
-}
-
-static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len TSRMLS_DC)
-{
- pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data;
-
- if (!S->result) {
- return 0;
- }
-
- /* We have already increased count by 1 in pgsql_stmt_fetch() */
- *ptr = PQgetvalue(S->result, S->current_row - 1, colno);
- *len = PQgetlength(S->result, S->current_row - 1, colno);
-
- return 1;
-}
-
-struct pdo_stmt_methods pgsql_stmt_methods = {
- pgsql_stmt_dtor,
- pgsql_stmt_execute,
- pgsql_stmt_fetch,
- pgsql_stmt_describe,
- pgsql_stmt_get_col,
- pgsql_stmt_param_hook
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_pgsql/php_pdo_pgsql.h b/ext/pdo_pgsql/php_pdo_pgsql.h
deleted file mode 100644
index bcfd2bb2cd..0000000000
--- a/ext/pdo_pgsql/php_pdo_pgsql.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@emini.dk> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDO_PGSQL_H
-#define PHP_PDO_PGSQL_H
-
-#if HAVE_PDO_PGSQL
-
-#include <libpq-fe.h>
-
-extern zend_module_entry pdo_pgsql_module_entry;
-#define phpext_pdo_pgsql_ptr &pdo_pgsql_module_entry
-
-#ifdef PHP_WIN32
-#define PHP_PDO_PGSQL_API __declspec(dllexport)
-#else
-#define PHP_PDO_PGSQL_API
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(pdo_pgsql);
-PHP_MSHUTDOWN_FUNCTION(pdo_pgsql);
-PHP_RINIT_FUNCTION(pdo_pgsql);
-PHP_RSHUTDOWN_FUNCTION(pdo_pgsql);
-PHP_MINFO_FUNCTION(pdo_pgsql);
-
-#endif /* HAVE_PDO_PGSQL */
-#endif /* PHP_PDO_PGSQL_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h
deleted file mode 100644
index 27d84277b9..0000000000
--- a/ext/pdo_pgsql/php_pdo_pgsql_int.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Edin Kadribasic <edink@emini.dk> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDO_PGSQL_INT_H
-#define PHP_PDO_PGSQL_INT_H
-
-#if HAVE_PDO_PGSQL
-
-#include <libpq-fe.h>
-
-typedef struct {
- const char *file;
- int line;
- unsigned int errcode;
- char *errmsg;
-} pdo_pgsql_error_info;
-
-/* stuff we use in a pgsql database handle */
-typedef struct {
- PGconn *server;
- unsigned attached:1;
- unsigned _reserved:31;
- pdo_pgsql_error_info einfo;
- Oid pgoid;
-} pdo_pgsql_db_handle;
-
-typedef struct {
- char *def;
-} pdo_pgsql_column;
-
-typedef struct {
- pdo_pgsql_db_handle *H;
- PGresult *result;
- int current_row;
- pdo_pgsql_column *cols;
-} pdo_pgsql_stmt;
-
-typedef struct {
- char *repr;
- long repr_len;
- int pgsql_type;
- void *thing; /* for LOBS, REFCURSORS etc. */
-} pdo_pgsql_bound_param;
-
-extern pdo_driver_t pdo_pgsql_driver;
-
-extern int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *file, int line TSRMLS_DC);
-#define pdo_pgsql_error(d,e) _pdo_pgsql_error(d, NULL, e, __FILE__, __LINE__ TSRMLS_CC)
-#define pdo_pgsql_error_stmt(s,e) _pdo_pgsql_error(s->dbh, s, e, __FILE__, __LINE__ TSRMLS_CC)
-
-extern struct pdo_stmt_methods pgsql_stmt_methods;
-
-#endif /* HAVE_PDO_PGSQL */
-#endif /* PHP_PDO_PGSQL_INT_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */