summaryrefslogtreecommitdiff
path: root/ext/pdo
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo')
-rwxr-xr-xext/pdo/CREDITS2
-rw-r--r--ext/pdo/EXPERIMENTAL0
-rw-r--r--ext/pdo/Makefile.frag31
-rwxr-xr-xext/pdo/README56
-rwxr-xr-xext/pdo/TODO25
-rwxr-xr-xext/pdo/config.m410
-rwxr-xr-xext/pdo/config.w329
-rwxr-xr-xext/pdo/package.xml84
-rwxr-xr-xext/pdo/pdo.c314
-rwxr-xr-xext/pdo/pdo.php35
-rwxr-xr-xext/pdo/pdo_dbh.c696
-rw-r--r--ext/pdo/pdo_sql_parser.c317
-rw-r--r--ext/pdo/pdo_sql_parser.re201
-rwxr-xr-xext/pdo/pdo_stmt.c1106
-rwxr-xr-xext/pdo/php_pdo.h69
-rwxr-xr-xext/pdo/php_pdo_driver.h411
-rwxr-xr-xext/pdo/php_pdo_int.h61
-rw-r--r--ext/pdo/php_pdo_sql_parser.h27
18 files changed, 0 insertions, 3454 deletions
diff --git a/ext/pdo/CREDITS b/ext/pdo/CREDITS
deleted file mode 100755
index e650219359..0000000000
--- a/ext/pdo/CREDITS
+++ /dev/null
@@ -1,2 +0,0 @@
-PHP Data Objects
-Wez Furlong, Marcus Boerger, Sterling Hughes, George Schlossnagle
diff --git a/ext/pdo/EXPERIMENTAL b/ext/pdo/EXPERIMENTAL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/ext/pdo/EXPERIMENTAL
+++ /dev/null
diff --git a/ext/pdo/Makefile.frag b/ext/pdo/Makefile.frag
deleted file mode 100644
index c28a5cee50..0000000000
--- a/ext/pdo/Makefile.frag
+++ /dev/null
@@ -1,31 +0,0 @@
-phpincludedir=$(prefix)/include/php
-
-PDO_HEADER_FILES= \
- php_pdo.h \
- php_pdo_driver.h
-
-install-pdo-headers:
- echo "Installing PDO headers: $(INSTALL_ROOT)$(phpincludedir)/ext/pdo/"
- $(mkinstalldirs) $(INSTALL_ROOT)$(phpincludedir)/ext/pdo
- for f in $(PDO_HEADER_FILES); do \
- if test -f "$(top_srcdir)/$$f"; then \
- $(INSTALL_DATA) $(top_srcdir)/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/pdo; \
- elif test -f "$(top_builddir)/$$f"; then \
- $(INSTALL_DATA) $(top_builddir)/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/pdo; \
- elif test -f "$(top_srcdir)/ext/pdo/$$f"; then \
- $(INSTALL_DATA) $(top_srcdir)/ext/pdo/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/pdo; \
- elif test -f "$(top_builddir)/ext/pdo/$$f"; then \
- $(INSTALL_DATA) $(top_builddir)/ext/pdo/$$f $(INSTALL_ROOT)$(phpincludedir)/ext/pdo; \
- else \
- echo "hmmm"; \
- fi \
- done;
-
-# mini hack
-install: $(all_targets) $(install_targets) install-pdo-headers
-
-$(top_srcdir)/ext/pdo/pdo_sql_parser.c: $(top_srcdir)/ext/pdo/pdo_sql_parser.re
- re2c -b $(top_srcdir)/ext/pdo/pdo_sql_parser.re > $@
-
-$(srcdir)/pdo_sql_parser.c: $(srcdir)/pdo_sql_parser.re
- re2c -b $(srcdir)/pdo_sql_parser.re > $@
diff --git a/ext/pdo/README b/ext/pdo/README
deleted file mode 100755
index ea3ee74fb6..0000000000
--- a/ext/pdo/README
+++ /dev/null
@@ -1,56 +0,0 @@
-$Id$
-
-PHP Data Objects
-================
-
-Concept: Data Access Abstraction
-
-Goals:
-
-1/ Be light-weight
-2/ Provide common API for common database operations
-3/ Be performant
-4/ Keep majority of PHP specific stuff in the PDO core (such as persistent
- resource management); drivers should only have to worry about getting the
- data and not about PHP internals.
-
-
-Transactions and autocommit
-===========================
-
-When you create a database handle, you *should* specify the autocommit
-behaviour that you require. PDO will default to autocommit on.
-
-$dbh = new PDO("...", $user, $pass, array(PDO_ATTR_AUTOCOMMIT => true));
-
-When auto-commit is on, the driver will implicitly commit each query as it is
-executed. This works fine for most simple tasks but can be significantly
-slower when you are making a large number of udpates.
-
-$dbh = new PDO("...", $user, $pass, array(PDO_ATTR_AUTOCOMMIT => false));
-
-When auto-commit is off, you must then use $dbh->beginWork() to initiate a
-transaction. When your work is done, you then call $dbh->commit() or
-$dbh->rollBack() to persist or abort your changes respectively.
-Not all databases support transactions.
-
-You can change the auto-commit mode at run-time:
-
-$dbh->setAttribute(PDO_ATTR_AUTOCOMMIT, false);
-
-Regardless of the error handling mode set on the database handle, if the
-autocommit mode cannot be changed, an exception will be thrown.
-
-Some drivers will allow you to temporarily disable autocommit if you call
-$dbh->beginWork(). When you commit() or rollBack() such a transaction, the
-handle will switch back to autocommit mode again. If the mode could not be
-changed, an exception will be raised, as noted above.
-
-When the database handle is closed or destroyed (or at request end for
-persistent handles), the driver will implicitly rollBack(). It is your
-responsibility to call commit() when you are done making changes and
-autocommit is turned off.
-
-vim:tw=78:et
-
-
diff --git a/ext/pdo/TODO b/ext/pdo/TODO
deleted file mode 100755
index 43da3fe9a6..0000000000
--- a/ext/pdo/TODO
+++ /dev/null
@@ -1,25 +0,0 @@
-$Id$
-
-In no particular order:
-
-Low-level:
-
-- Scanner for :named placeholders and prepare()/execute() emulation (George)
-- $dbh->quote()
-- Exceptions and unified error API
-- Scrollable cursors
-- meta data from driver, such as server version and supported features
-- field meta data from statement handles
-- $dbh->exec() for one-shot SQL
-- LOB support via Streams API
-- persistent handles
-- iterator support
-- "lazy" fetch support
-
-Not-so-low-level:
-- hash key case folding for portabilitiy, ala sqlite.assoc_case, but not using an ini option.
-- fetchAll(), single row, single column fetches etc.
-
-Could be more...
-
-vim:tw=78:et
diff --git a/ext/pdo/config.m4 b/ext/pdo/config.m4
deleted file mode 100755
index 60e6039550..0000000000
--- a/ext/pdo/config.m4
+++ /dev/null
@@ -1,10 +0,0 @@
-dnl $Id$
-dnl config.m4 for extension pdo
-
-PHP_ARG_ENABLE(pdo, whether to enable PDO support,
-[ --enable-pdo Enable PHP Data Objects support])
-
-if test "$PHP_PDO" != "no"; then
- PHP_NEW_EXTENSION(pdo, pdo.c pdo_dbh.c pdo_stmt.c pdo_sql_parser.c, $ext_shared)
- PHP_ADD_MAKEFILE_FRAGMENT
-fi
diff --git a/ext/pdo/config.w32 b/ext/pdo/config.w32
deleted file mode 100755
index 112c7d9fce..0000000000
--- a/ext/pdo/config.w32
+++ /dev/null
@@ -1,9 +0,0 @@
-// $Id$
-// vim:ft=javascript
-
-ARG_ENABLE("pdo", "Enable PHP Data Objects support", "no");
-
-if (PHP_PDO != "no") {
- EXTENSION('pdo', 'pdo.c pdo_dbh.c pdo_stmt.c pdo_sql_parser.c');
-}
-
diff --git a/ext/pdo/package.xml b/ext/pdo/package.xml
deleted file mode 100755
index 963d3e939b..0000000000
--- a/ext/pdo/package.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE package SYSTEM "../pear/package.dtd">
-<package version="1.0">
- <name>PDO</name>
- <summary>PHP Data Objects Interface</summary>
- <maintainers>
- <maintainer>
- <user>wez</user>
- <name>Wez Furlong</name>
- <email>wez@php.net</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>helly</user>
- <name>Marcus Boerger</name>
- <email>helly@php.net</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>iliaa</user>
- <name>Ilia Alshanetsky</name>
- <email>iliaa@php.net</email>
- <role>lead</role>
- </maintainer>
- <maintainer>
- <user>gschlossnagle</user>
- <name>George Schlossnagle</name>
- <email>george@omniti.com</email>
- <role>lead</role>
- </maintainer>
- </maintainers>
- <description>
- PDO provides a uniform data access interface, sporting advanced features such
- as prepared statements and bound parameters. PDO drivers are dynamically
- loadable and may be developed independently from the core, but still accessed
- using the same API.
- </description>
- <license>PHP</license>
- <release>
- <state>alpha</state>
- <version>0.1.1</version>
- <date>2004-05-21</date>
-
- <notes>
-Note that PDO on its own is useless.
-You need to install a PDO database driver to make use of it,
-check http://pecl.php.net for a list of available PDO drivers.
-
-It is highly recommended that you update to the latest PHP 5 snapshot before using PDO.
-You can obtain it from http://snaps.php.net.
-
-If you are running on Windows, you should download:
-http://snaps.php.net/win32/php5-win32-latest.zip
-http://snaps.php.net/win32/PECL_5_0/php_pdo.dll
-
-You can find additional PDO drivers at:
-http://snaps.php.net/win32/PECL_5_0/
-
- </notes>
-
- <filelist>
- <file role="src" name="config.m4"/>
- <file role="src" name="config.w32"/>
- <file role="src" name="pdo.c"/>
- <file role="src" name="pdo_dbh.c"/>
- <file role="src" name="pdo_stmt.c"/>
- <file role="src" name="php_pdo.h"/>
- <file role="src" name="php_pdo_driver.h"/>
- <file role="src" name="php_pdo_int.h"/>
- <file role="src" name="pdo_sql_parser.re"/>
- <file role="src" name="pdo_sql_parser.c"/>
- <file role="src" name="php_pdo_sql_parser.h"/>
- <file role="src" name="Makefile.frag"/>
-
- <file role="doc" name="README"/>
- <file role="doc" name="TODO"/>
- <file role="doc" name="pdo.php"/>
- <file role="doc" name="CREDITS"/>
- </filelist>
- <deps>
- <dep type="php" rel="ge" version="5.0.0RC3-dev"/>
- </deps>
- </release>
-</package>
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
deleted file mode 100755
index 580ee5a755..0000000000
--- a/ext/pdo/pdo.c
+++ /dev/null
@@ -1,314 +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: Wez Furlong <wez@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <ctype.h>
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_pdo.h"
-#include "php_pdo_driver.h"
-#include "php_pdo_int.h"
-#include "zend_exceptions.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(pdo)
-
-/* True global resources - no need for thread safety here */
-
-/* the registry of PDO drivers */
-static HashTable pdo_driver_hash;
-
-/* we use persistent resources for the driver connection stuff */
-static int le_ppdo;
-
-/* for exceptional circumstances */
-zend_class_entry *pdo_exception_ce;
-
-PDO_API zend_class_entry *php_pdo_get_exception(void)
-{
- return pdo_exception_ce;
-}
-
-zend_class_entry *pdo_dbh_ce, *pdo_dbstmt_ce, *pdo_row_ce;
-
-/* {{{ pdo_functions[] */
-function_entry pdo_functions[] = {
- {NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ pdo_module_entry */
-zend_module_entry pdo_module_entry = {
- STANDARD_MODULE_HEADER,
- "PDO",
- pdo_functions,
- PHP_MINIT(pdo),
- PHP_MSHUTDOWN(pdo),
- PHP_RINIT(pdo),
- PHP_RSHUTDOWN(pdo),
- PHP_MINFO(pdo),
- "0.1.1",
- STANDARD_MODULE_PROPERTIES
-};
-/* }}} */
-
-#ifdef COMPILE_DL_PDO
-ZEND_GET_MODULE(pdo)
-#endif
-
-/* {{{ PHP_INI */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("pdo.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_pdo_globals, pdo_globals)
-PHP_INI_END()
-/* }}} */
-
-/* {{{ php_pdo_init_globals */
-static void php_pdo_init_globals(zend_pdo_globals *pdo_globals)
-{
- pdo_globals->global_value = 0;
-}
-/* }}} */
-
-PDO_API int php_pdo_register_driver(pdo_driver_t *driver)
-{
- if (driver->api_version != PDO_DRIVER_API) {
- zend_error(E_ERROR, "failed api version check");
- return FAILURE;
- }
- if (!zend_hash_exists(&module_registry, "pdo", sizeof("pdo"))) {
- zend_error(E_ERROR, "You MUST load PDO before loading any PDO drivers");
- return FAILURE; /* NOTREACHED */
- }
-
- return zend_hash_add(&pdo_driver_hash, (char*)driver->driver_name, driver->driver_name_len,
- (void**)&driver, sizeof(driver), NULL);
-}
-
-PDO_API void php_pdo_unregister_driver(pdo_driver_t *driver)
-{
- if (!zend_hash_exists(&module_registry, "pdo", sizeof("pdo"))) {
- return;
- }
-
- zend_hash_del(&pdo_driver_hash, (char*)driver->driver_name, driver->driver_name_len);
-}
-
-pdo_driver_t *pdo_find_driver(const char *name, int namelen)
-{
- pdo_driver_t **driver = NULL;
-
- zend_hash_find(&pdo_driver_hash, (char*)name, namelen, (void**)&driver);
-
- return driver ? *driver : NULL;
-}
-
-PDO_API int php_pdo_parse_data_source(const char *data_source,
- unsigned long data_source_len, struct pdo_data_src_parser *parsed,
- int nparams)
-{
- int i, j;
- int valstart = -1;
- int semi = -1;
- int optstart = 0;
- int nlen;
- int n_matches = 0;
-
- i = 0;
- while (i < data_source_len) {
- /* looking for NAME= */
-
- if (data_source[i] == '\0') {
- break;
- }
-
- if (data_source[i] != '=') {
- ++i;
- continue;
- }
-
- valstart = ++i;
-
- /* now we're looking for VALUE; or just VALUE<NUL> */
- semi = -1;
- while (i < data_source_len) {
- if (data_source[i] == '\0') {
- semi = i++;
- break;
- }
- if (data_source[i] == ';') {
- semi = i++;
- break;
- }
- ++i;
- }
-
- if (semi == -1) {
- semi = i;
- }
-
- /* find the entry in the array */
- nlen = valstart - optstart - 1;
- for (j = 0; j < nparams; j++) {
- if (0 == strncmp(data_source + optstart, parsed[j].optname, nlen) && parsed[j].optname[nlen] == '\0') {
- /* got a match */
- if (parsed[j].freeme) {
- efree(parsed[j].optval);
- }
- parsed[j].optval = estrndup(data_source + valstart, semi - valstart);
- parsed[j].freeme = 1;
- ++n_matches;
- break;
- }
- }
-
- while (i < data_source_len && isspace(data_source[i])) {
- i++;
- }
-
- optstart = i;
- }
-
- return n_matches;
-}
-
-
-/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION(pdo)
-{
- zend_class_entry ce;
-
- ZEND_INIT_MODULE_GLOBALS(pdo, php_pdo_init_globals, NULL);
- REGISTER_INI_ENTRIES();
-
- zend_hash_init(&pdo_driver_hash, 0, NULL, NULL, 1);
-
- REGISTER_LONG_CONSTANT("PDO_PARAM_NULL", (long)PDO_PARAM_NULL, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_PARAM_INT", (long)PDO_PARAM_INT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_PARAM_STR", (long)PDO_PARAM_STR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_PARAM_LOB", (long)PDO_PARAM_LOB, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_PARAM_STMT", (long)PDO_PARAM_STMT, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_FETCH_LAZY", (long)PDO_FETCH_LAZY, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_ASSOC",(long)PDO_FETCH_ASSOC, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_NUM", (long)PDO_FETCH_NUM, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_BOTH", (long)PDO_FETCH_BOTH, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_OBJ", (long)PDO_FETCH_OBJ, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_ATTR_AUTOCOMMIT", (long)PDO_ATTR_AUTOCOMMIT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_SCROLL", (long)PDO_ATTR_SCROLL, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_PREFETCH", (long)PDO_ATTR_PREFETCH, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_TIMEOUT", (long)PDO_ATTR_TIMEOUT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_ERRMODE", (long)PDO_ATTR_ERRMODE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_SERVER_VERSION", (long)PDO_ATTR_SERVER_VERSION, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_CLIENT_VERSION", (long)PDO_ATTR_CLIENT_VERSION, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_SERVER_INFO", (long)PDO_ATTR_SERVER_INFO, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_CONNECTION_STATUS", (long)PDO_ATTR_CONNECTION_STATUS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_CASE", (long)PDO_ATTR_CASE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_CURSOR_NAME", (long)PDO_ATTR_CURSOR_NAME, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_CURSOR", (long)PDO_ATTR_CURSOR, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_ERRMODE_SILENT", (long)PDO_ERRMODE_SILENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERRMODE_WARNING", (long)PDO_ERRMODE_WARNING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERRMODE_EXCEPTION", (long)PDO_ERRMODE_EXCEPTION, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_CASE_NATURAL", (long)PDO_CASE_NATURAL, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_CASE_LOWER", (long)PDO_CASE_LOWER, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_CASE_UPPER", (long)PDO_CASE_UPPER, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_ERR_NONE", (long)PDO_ERR_NONE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_CANT_MAP", (long)PDO_ERR_CANT_MAP, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_SYNTAX", (long)PDO_ERR_SYNTAX, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_CONSTRAINT", (long)PDO_ERR_CONSTRAINT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_NOT_FOUND", (long)PDO_ERR_NOT_FOUND, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_ALREADY_EXISTS", (long)PDO_ERR_ALREADY_EXISTS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_NOT_IMPLEMENTED", (long)PDO_ERR_NOT_IMPLEMENTED, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_MISMATCH", (long)PDO_ERR_MISMATCH, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_TRUNCATED", (long)PDO_ERR_TRUNCATED, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ERR_DISCONNECTED", (long)PDO_ERR_DISCONNECTED, CONST_CS|CONST_PERSISTENT);
-
- INIT_CLASS_ENTRY(ce, "PDOException", NULL);
- pdo_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
- zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC TSRMLS_CC);
-
- INIT_CLASS_ENTRY(ce, "PDO", pdo_dbh_functions);
- ce.create_object = pdo_dbh_new;
- pdo_dbh_ce = zend_register_internal_class(&ce TSRMLS_CC);
-
- INIT_CLASS_ENTRY(ce, "PDOStatement", pdo_dbstmt_functions);
- ce.create_object = pdo_dbstmt_new;
- pdo_dbstmt_ce = zend_register_internal_class(&ce TSRMLS_CC);
-
- INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions);
- ce.create_object = pdo_row_new;
- pdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC);
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MSHUTDOWN_FUNCTION */
-PHP_MSHUTDOWN_FUNCTION(pdo)
-{
- UNREGISTER_INI_ENTRIES();
- zend_hash_destroy(&pdo_driver_hash);
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RINIT_FUNCTION */
-PHP_RINIT_FUNCTION(pdo)
-{
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION */
-PHP_RSHUTDOWN_FUNCTION(pdo)
-{
- /* TODO: visit persistent handles: for each persistent statement handle,
- * remove bound parameter associations */
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_MINFO_FUNCTION */
-PHP_MINFO_FUNCTION(pdo)
-{
- php_info_print_table_start();
- php_info_print_table_header(2, "pdo support", "enabled");
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-
-/*
- * 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/pdo.php b/ext/pdo/pdo.php
deleted file mode 100755
index 78300d82b5..0000000000
--- a/ext/pdo/pdo.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-//$x = new PDO("oci:dbname=hostname", 'php', 'php');
-$x = new PDO("odbc:ram", 'php', 'php', array(PDO_ATTR_AUTOCOMMIT => 0));
-$stmt = $x->prepare("select NAME, VALUE from test where value like ?");
-
-$the_name = 'bar%';
-$stmt->execute(array($the_name)) or die("failed to execute!");
-$stmt->bindColumn('VALUE', $value);
-
-while ($row = $stmt->fetch()) {
- echo "name=$row[NAME] value=$row[VALUE]\n";
- echo "value is $value\n";
- echo "\n";
-}
-
-echo "Let's try an update\n";
-
-$stmt = $x->prepare("INSERT INTO test (NAME, VALUE) VALUES (:name, :value)");
-
-$stmt->bindParam(":name", $the_name, PDO_PARAM_STR, 32);
-$stmt->bindParam(":value", $the_value, PDO_PARAM_STR, 32);
-
-for ($i = 0; $i < 4; $i++) {
- $the_name = "foo" . rand();
- $the_value = "bar" . rand();
-
- if (!$stmt->execute()) {
- break;
- }
-}
-
-echo "All done\n";
-
-?>
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
deleted file mode 100755
index 8d40d24d32..0000000000
--- a/ext/pdo/pdo_dbh.c
+++ /dev/null
@@ -1,696 +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: Wez Furlong <wez@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* The PDO Database Handle Class */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_pdo.h"
-#include "php_pdo_driver.h"
-#include "php_pdo_int.h"
-#include "zend_exceptions.h"
-
-void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC)
-{
- enum pdo_error_type *pdo_err = &dbh->error_code;
- const char *msg = "<<Unknown>>";
- char *supp = NULL;
- long native_code = 0;
- char *message = NULL;
- zval *info = NULL;
-
- if (dbh->error_mode == PDO_ERRMODE_SILENT) {
- return;
- }
-
- if (stmt) {
- pdo_err = &stmt->error_code;
- }
-
- switch (*pdo_err) {
- case PDO_ERR_NONE: msg = "No error"; break;
- case PDO_ERR_CANT_MAP: msg = "Consult errorInfo() for more details"; break;
- case PDO_ERR_SYNTAX: msg = "Syntax Error"; break;
- case PDO_ERR_CONSTRAINT:msg = "Constraint violation"; break;
- case PDO_ERR_NOT_FOUND: msg = "Not found"; break;
- case PDO_ERR_ALREADY_EXISTS: msg = "Already exists"; break;
- case PDO_ERR_NOT_IMPLEMENTED: msg = "Not Implemented"; break;
- case PDO_ERR_MISMATCH: msg = "Mismatch"; break;
- case PDO_ERR_TRUNCATED: msg = "Truncated"; break;
- case PDO_ERR_DISCONNECTED: msg = "Disconnected"; break;
- default: msg = "<<Invalid>>";
- }
-
- if (dbh->methods->fetch_err) {
-
- MAKE_STD_ZVAL(info);
- array_init(info);
-
- add_next_index_long(info, *pdo_err);
-
- if (dbh->methods->fetch_err(dbh, stmt, info TSRMLS_CC)) {
- zval **item;
-
- if (SUCCESS == zend_hash_index_find(Z_ARRVAL_P(info), 1, (void**)&item)) {
- native_code = Z_LVAL_PP(item);
- }
-
- if (SUCCESS == zend_hash_index_find(Z_ARRVAL_P(info), 2, (void**)&item)) {
- supp = estrndup(Z_STRVAL_PP(item), Z_STRLEN_PP(item));
- }
- }
- }
-
- if (supp && *pdo_err == PDO_ERR_CANT_MAP) {
- spprintf(&message, 0, "%ld %s", native_code, supp);
- } else if (supp) {
- spprintf(&message, 0, "%s: %ld %s", msg, native_code, supp);
- } else {
- spprintf(&message, 0, "%s", msg);
- }
-
- if (dbh->error_mode == PDO_ERRMODE_WARNING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message);
-
- if (info) {
- zval_dtor(info);
- FREE_ZVAL(info);
- }
- } else {
- zval *ex;
- zend_class_entry *def_ex = zend_exception_get_default(), *pdo_ex = php_pdo_get_exception();
-
- MAKE_STD_ZVAL(ex);
- object_init_ex(ex, pdo_ex);
-
- zend_update_property_string(def_ex, ex, "message", sizeof("message")-1, message TSRMLS_CC);
- zend_update_property_long(def_ex, ex, "code", sizeof("code")-1, *pdo_err TSRMLS_CC);
-
- if (info) {
- zend_update_property(pdo_ex, ex, "errorInfo", sizeof("errorInfo")-1, info TSRMLS_CC);
- }
-
- zend_throw_exception_object(ex TSRMLS_CC);
- }
-
- if (message) {
- efree(message);
- }
-
- if (supp) {
- efree(supp);
- }
-}
-
-/* {{{ proto object PDO::__construct(string dsn, string username, string passwd [, array driver_opts])
- */
-static PHP_FUNCTION(dbh_constructor)
-{
- zval *object = getThis();
- pdo_dbh_t *dbh = NULL;
- zend_bool is_persistent = FALSE;
- char *data_source;
- long data_source_len;
- char *colon;
- char *username=NULL, *password=NULL;
- long usernamelen, passwordlen;
- pdo_driver_t *driver = NULL;
- zval *driver_options = NULL;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ssa!", &data_source, &data_source_len,
- &username, &usernamelen, &password, &passwordlen, &driver_options)) {
- ZVAL_NULL(object);
- return;
- }
-
- /* parse the data source name */
- colon = strchr(data_source, ':');
-
- if (!colon) {
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_SYNTAX TSRMLS_CC, "invalid data source name");
- ZVAL_NULL(object);
- return;
- }
-
- driver = pdo_find_driver(data_source, colon - data_source);
-
- if (!driver) {
- /* NB: don't want to include the data_source in the error message as
- * it might contain a password */
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NOT_FOUND TSRMLS_CC, "could not find driver");
- ZVAL_NULL(object);
- return;
- }
-
- dbh = pemalloc(sizeof(*dbh), is_persistent);
-
- if (dbh == NULL) {
- /* need this check for persistent allocations */
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "out of memory!?");
- }
-
- memset(dbh, 0, sizeof(*dbh));
- dbh->is_persistent = is_persistent;
-
- dbh->data_source_len = strlen(colon + 1);
- /* when persistent stuff is done, we should check the return values here
- * too */
- dbh->data_source = (const char*)pestrdup(colon + 1, is_persistent);
- dbh->username = username ? pestrdup(username, is_persistent) : NULL;
- dbh->password = password ? pestrdup(password, is_persistent) : NULL;
-
- dbh->auto_commit = pdo_attr_lval(driver_options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC);
-
- if (driver->db_handle_factory(dbh, driver_options TSRMLS_CC)) {
- /* all set */
-
- if (is_persistent) {
- /* register in the persistent list etc. */
- ;
- }
-
- zend_object_store_set_object(object, dbh TSRMLS_CC);
- return;
- }
-
- /* the connection failed; tidy things up */
- pefree((char*)dbh->data_source, is_persistent);
- pefree(dbh, is_persistent);
-
- /* XXX raise exception */
- ZVAL_NULL(object);
-}
-/* }}} */
-
-/* {{{ proto object PDO::prepare(string statment [, int options [, array driver_options]])
- Prepares a statement for execution and returns a statement object */
-/* TODO: options will be a PDO specific bitmask controlling such things as
- * cursor type. */
-static PHP_METHOD(PDO, prepare)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
- pdo_stmt_t *stmt;
- char *statement;
- long statement_len;
- zval *driver_options = NULL;
- long options = 0;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|la", &statement,
- &statement_len, &options, &driver_options)) {
- RETURN_FALSE;
- }
-
- PDO_DBH_CLEAR_ERR();
- stmt = ecalloc(1, sizeof(*stmt));
- /* unconditionally keep this for later reference */
- stmt->query_string = estrndup(statement, statement_len);
- stmt->query_stringlen = statement_len;
- if (dbh->methods->preparer(dbh, statement, statement_len, stmt, options, driver_options TSRMLS_CC)) {
- /* prepared; create a statement object for PHP land to access it */
- Z_TYPE_P(return_value) = IS_OBJECT;
- Z_OBJ_HANDLE_P(return_value) = zend_objects_store_put(stmt, NULL, pdo_dbstmt_free_storage, NULL TSRMLS_CC);
- Z_OBJ_HT_P(return_value) = &pdo_dbstmt_object_handlers;
-
- /* give it a reference to me */
- stmt->database_object_handle = *getThis();
- zend_objects_store_add_ref(getThis() TSRMLS_CC);
- stmt->dbh = dbh;
-
- /* we haven't created a lazy object yet */
- ZVAL_NULL(&stmt->lazy_object_ref);
-
- stmt->refcount = 1;
- return;
- }
- efree(stmt);
- PDO_HANDLE_DBH_ERR();
- RETURN_FALSE;
-}
-
-/* {{{ proto bool PDO::beginTransaction()
- Initiates a transaction */
-static PHP_METHOD(PDO, beginTransaction)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (dbh->in_txn) {
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "There is already an active transaction");
- RETURN_FALSE;
- }
-
- if (!dbh->methods->begin) {
- /* TODO: this should be an exception; see the auto-commit mode
- * comments below */
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "This driver doesn't support transactions");
- RETURN_FALSE;
- }
-
- if (dbh->methods->begin(dbh TSRMLS_CC)) {
- dbh->in_txn = 1;
- RETURN_TRUE;
- }
-
- PDO_HANDLE_DBH_ERR();
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool PDO::commit()
- Commit a transaction */
-static PHP_METHOD(PDO, commit)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (!dbh->in_txn) {
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "There is no active transaction");
- RETURN_FALSE;
- }
-
- if (dbh->methods->commit(dbh TSRMLS_CC)) {
- dbh->in_txn = 0;
- RETURN_TRUE;
- }
-
- PDO_HANDLE_DBH_ERR();
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool PDO::rollBack()
- roll back a transaction */
-static PHP_METHOD(PDO, rollBack)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (!dbh->in_txn) {
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "There is no active transaction");
- RETURN_FALSE;
- }
-
- if (dbh->methods->rollback(dbh TSRMLS_CC)) {
- dbh->in_txn = 0;
- RETURN_TRUE;
- }
-
- PDO_HANDLE_DBH_ERR();
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto bool PDO::setAttribute(long attribute, mixed value)
- Set an attribute */
-static PHP_METHOD(PDO, setAttribute)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
- long attr;
- zval *value = NULL;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz!", &attr, &value)) {
- RETURN_FALSE;
- }
-
- switch (attr) {
- case PDO_ATTR_ERRMODE:
- convert_to_long(value);
- switch (Z_LVAL_P(value)) {
- case PDO_ERRMODE_SILENT:
- case PDO_ERRMODE_WARNING:
- case PDO_ERRMODE_EXCEPTION:
- dbh->error_mode = Z_LVAL_P(value);
- RETURN_TRUE;
- default:
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_SYNTAX TSRMLS_CC, "Error mode %d is invalid", Z_LVAL_P(value));
- }
- RETURN_FALSE;
-
- case PDO_ATTR_CASE:
- convert_to_long(value);
- switch (Z_LVAL_P(value)) {
- case PDO_CASE_NATURAL:
- case PDO_CASE_UPPER:
- case PDO_CASE_LOWER:
- dbh->desired_case = Z_LVAL_P(value);
- RETURN_TRUE;
- default:
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_SYNTAX TSRMLS_CC, "Case folding mode %d is invalid", Z_LVAL_P(value));
- }
- RETURN_FALSE;
-
- default:
- ;
- }
-
- if (!dbh->methods->set_attribute) {
- goto fail;
- }
-
- PDO_DBH_CLEAR_ERR();
- if (dbh->methods->set_attribute(dbh, attr, value TSRMLS_CC)) {
- RETURN_TRUE;
- }
-
-fail:
- if (attr == PDO_ATTR_AUTOCOMMIT) {
- zend_throw_exception_ex(php_pdo_get_exception(), PDO_ERR_NONE TSRMLS_CC, "The auto-commit mode cannot be changed for this driver");
- } else if (!dbh->methods->set_attribute) {
- /* XXX: do something better here */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This driver doesn't support setting attributes");
- } else {
- PDO_HANDLE_DBH_ERR();
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto mixed PDO::getAttribute(long attribute)
- Get an attribute */
-static PHP_METHOD(PDO, getAttribute)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
- long attr;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) {
- RETURN_FALSE;
- }
-
- if (!dbh->methods->get_attribute) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This driver doesn't support fetching attributes");
- RETURN_FALSE;
- }
-
- PDO_DBH_CLEAR_ERR();
- switch (dbh->methods->get_attribute(dbh, attr, return_value TSRMLS_CC)) {
- case -1:
- PDO_HANDLE_DBH_ERR();
- RETURN_FALSE;
-
- case 0:
- /* XXX: should do something better here */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This driver doesn't support fetching %ld attribute", attr);
- break;
-
- default:
- return;
- }
-}
-/* }}} */
-
-/* {{{ proto long PDO::exec(string query)
- Execute a query that does not return a row set, returning the number of affected rows */
-static PHP_METHOD(PDO, exec)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
- char *statement;
- long statement_len;
- long ret;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &statement, &statement_len)) {
- RETURN_FALSE;
- }
-
- if (!statement_len) {
- RETURN_FALSE;
- }
- PDO_DBH_CLEAR_ERR();
- ret = dbh->methods->doer(dbh, statement, statement_len TSRMLS_CC);
- if(ret == -1) {
- PDO_HANDLE_DBH_ERR();
- RETURN_FALSE;
- } else {
- RETURN_LONG(ret);
- }
-}
-/* }}} */
-
-
-/* {{{ proto int PDO::lastInsertId()
- Returns the number id of rows that we affected by the last call to PDO::exec(). Not always meaningful. */
-static PHP_METHOD(PDO, lastInsertId)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS()) {
- RETURN_FALSE;
- }
-
- PDO_DBH_CLEAR_ERR();
- if (!dbh->methods->last_id) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This driver does not support last inserted id retrieval.");
- } else {
- RETURN_LONG(dbh->methods->last_id(dbh TSRMLS_CC));
- }
-}
-/* }}} */
-
-/* {{{ proto int PDO::errorCode()
- Fetch the error code associated with the last operation on the database handle */
-static PHP_METHOD(PDO, errorCode)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS()) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(dbh->error_code);
-}
-/* }}} */
-
-/* {{{ proto int PDO::errorInfo()
- Fetch extended error information associated with the last operation on the database handle */
-static PHP_METHOD(PDO, errorInfo)
-{
- pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS()) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- add_next_index_long(return_value, dbh->error_code);
-
- if (dbh->methods->fetch_err) {
- dbh->methods->fetch_err(dbh, NULL, return_value TSRMLS_CC);
- }
-}
-/* }}} */
-
-
-function_entry pdo_dbh_functions[] = {
- PHP_ME(PDO, prepare, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, beginTransaction,NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, commit, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, rollBack, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, setAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, exec, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, lastInsertId, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, errorCode, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, errorInfo, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, getAttribute, NULL, ZEND_ACC_PUBLIC)
-
- {NULL, NULL, NULL}
-};
-
-/* {{{ overloaded object handlers for PDO class */
-static zval *dbh_prop_read(zval *object, zval *member, int type TSRMLS_DC)
-{
- zval *return_value;
-
- MAKE_STD_ZVAL(return_value);
- ZVAL_NULL(return_value);
-
- return return_value;
-}
-
-static void dbh_prop_write(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- return;
-}
-
-static zval *dbh_read_dim(zval *object, zval *offset, int type TSRMLS_DC)
-{
- zval *return_value;
-
- MAKE_STD_ZVAL(return_value);
- ZVAL_NULL(return_value);
-
- return return_value;
-}
-
-static void dbh_write_dim(zval *object, zval *offset, zval *value TSRMLS_DC)
-{
- return;
-}
-
-static int dbh_prop_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- return 0;
-}
-
-static int dbh_dim_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- return 0;
-}
-
-static void dbh_prop_delete(zval *object, zval *offset TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot delete properties from a PDO DBH");
-}
-
-static void dbh_dim_delete(zval *object, zval *offset TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot delete dimensions from a PDO DBH");
-}
-
-static HashTable *dbh_get_properties(zval *object TSRMLS_DC)
-{
- return NULL;
-}
-
-static union _zend_function *dbh_method_get(zval *object, char *method_name, int method_len TSRMLS_DC)
-{
- zend_function *fbc;
- char *lc_method_name;
-
- lc_method_name = do_alloca(method_len + 1);
- zend_str_tolower_copy(lc_method_name, method_name, method_len);
-
- if (zend_hash_find(&pdo_dbh_ce->function_table, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) {
- free_alloca(lc_method_name);
- return NULL;
- }
-
- free_alloca(lc_method_name);
- return fbc;
-}
-
-static int dbh_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
-{
- return FAILURE;
-}
-
-static union _zend_function *dbh_get_ctor(zval *object TSRMLS_DC)
-{
- static zend_internal_function ctor = {0};
-
- ctor.type = ZEND_INTERNAL_FUNCTION;
- ctor.function_name = "__construct";
- ctor.scope = pdo_dbh_ce;
- ctor.handler = ZEND_FN(dbh_constructor);
-
- return (union _zend_function*)&ctor;
-}
-
-static zend_class_entry *dbh_get_ce(zval *object TSRMLS_DC)
-{
- return pdo_dbh_ce;
-}
-
-static int dbh_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
-{
- *class_name = estrndup("PDO", sizeof("PDO")-1);
- *class_name_len = sizeof("PDO")-1;
- return 0;
-}
-
-static int dbh_compare(zval *object1, zval *object2 TSRMLS_DC)
-{
- return -1;
-}
-
-static zend_object_handlers pdo_dbh_object_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
- dbh_prop_read,
- dbh_prop_write,
- dbh_read_dim,
- dbh_write_dim,
- NULL,
- NULL,
- NULL,
- dbh_prop_exists,
- dbh_prop_delete,
- dbh_dim_exists,
- dbh_dim_delete,
- dbh_get_properties,
- dbh_method_get,
- dbh_call_method,
- dbh_get_ctor,
- dbh_get_ce,
- dbh_get_classname,
- dbh_compare,
- NULL, /* cast */
- NULL
-};
-
-static void pdo_dbh_free_storage(zend_object *object TSRMLS_DC)
-{
- pdo_dbh_t *dbh = (pdo_dbh_t*)object;
-
- if (!dbh) {
- return;
- }
-
- if (dbh->is_persistent) {
- /* XXX: don't really free it, just delete the rsrc id */
- return;
- }
-
- dbh->methods->closer(dbh TSRMLS_CC);
-
- if (dbh->data_source) {
- pefree((char *)dbh->data_source, dbh->is_persistent);
- }
- if (dbh->username) {
- pefree(dbh->username, dbh->is_persistent);
- }
- if (dbh->password) {
- pefree(dbh->password, dbh->is_persistent);
- }
-
- pefree(dbh, dbh->is_persistent);
-}
-
-zend_object_value pdo_dbh_new(zend_class_entry *ce TSRMLS_DC)
-{
- zend_object_value retval;
-
- retval.handle = zend_objects_store_put(NULL, NULL, pdo_dbh_free_storage, NULL TSRMLS_CC);
- retval.handlers = &pdo_dbh_object_handlers;
-
- return retval;
-}
-
-/* }}} */
-
-/*
- * 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/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
deleted file mode 100644
index 5c4ee0ac06..0000000000
--- a/ext/pdo/pdo_sql_parser.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* Generated by re2c 0.5 on Fri May 21 17:33:58 2004 */
-#line 1 "/home/george/src/pecl/pdo/pdo_sql_parser.re"
-/*
- +----------------------------------------------------------------------+
- | 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: George Schlossnagle <george@omniti.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_pdo_driver.h"
-
-#define PDO_PARSER_TEXT 1
-#define PDO_PARSER_BIND 2
-#define PDO_PARSER_BIND_POS 3
-#define PDO_PARSER_EOI 4
-
-#define RET(i) {s->cur = cursor; return i; }
-
-#define YYCTYPE char
-#define YYCURSOR cursor
-#define YYLIMIT s->lim
-#define YYMARKER s->ptr
-#define YYFILL(n)
-
-typedef struct Scanner {
- char *lim, *ptr, *cur, *tok;
-} Scanner;
-
-static int scan(Scanner *s)
-{
- char *cursor = s->cur;
- std:
- s->tok = cursor;
- #line 54
-
-
- {
- YYCTYPE yych;
- unsigned int yyaccept;
- static unsigned char yybm[] = {
- 0, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 0, 168, 168, 168, 168, 192,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 184, 184, 184, 184, 184, 184, 184, 184,
- 184, 184, 160, 168, 168, 168, 168, 160,
- 168, 184, 184, 184, 184, 184, 184, 184,
- 184, 184, 184, 184, 184, 184, 184, 184,
- 184, 184, 184, 184, 184, 184, 184, 184,
- 184, 184, 184, 168, 8, 168, 168, 184,
- 168, 184, 184, 184, 184, 184, 184, 184,
- 184, 184, 184, 184, 184, 184, 184, 184,
- 184, 184, 184, 184, 184, 184, 184, 184,
- 184, 184, 184, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168,
- };
- goto yy0;
-yy1: ++YYCURSOR;
-yy0:
- if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
- yych = *YYCURSOR;
- if(yybm[0+yych] & 8) goto yy8;
- if(yych <= '\000') goto yy11;
- if(yych <= '&') goto yy2;
- if(yych <= '\'') goto yy4;
- if(yych <= '>') goto yy5;
- goto yy6;
-yy2: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych >= '\001') goto yy24;
-yy3:
-#line 61
- { RET(PDO_PARSER_TEXT); }
-yy4: yyaccept = 0;
- yych = *(YYMARKER = ++YYCURSOR);
- if(yych <= '\000') goto yy3;
- if(yych == '"') goto yy3;
- goto yy17;
-yy5: yych = *++YYCURSOR;
- if(yybm[0+yych] & 16) goto yy13;
- goto yy3;
-yy6: yych = *++YYCURSOR;
-yy7:
-#line 60
- { RET(PDO_PARSER_BIND_POS); }
-yy8: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy9: if(yybm[0+yych] & 8) goto yy8;
-yy10:
-#line 62
- { RET(PDO_PARSER_TEXT); }
-yy11: yych = *++YYCURSOR;
-yy12:
-#line 63
- { RET(PDO_PARSER_EOI); }
-yy13: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy14: if(yybm[0+yych] & 16) goto yy13;
-yy15:
-#line 59
- { RET(PDO_PARSER_BIND); }
-yy16: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy17: if(yybm[0+yych] & 32) goto yy16;
- if(yych <= '&') goto yy18;
- if(yych <= '\'') goto yy19;
- goto yy22;
-yy18: YYCURSOR = YYMARKER;
- switch(yyaccept){
- case 1: goto yy21;
- case 0: goto yy3;
- }
-yy19: yyaccept = 1;
- YYMARKER = ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy20: if(yybm[0+yych] & 32) goto yy16;
- if(yych <= '&') goto yy21;
- if(yych <= '\'') goto yy19;
- goto yy22;
-yy21:
-#line 58
- { RET(PDO_PARSER_TEXT); }
-yy22: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yych == '\'') goto yy16;
- goto yy18;
-yy23: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
-yy24: if(yybm[0+yych] & 128) goto yy23;
- if(yych <= '\000') goto yy18;
- if(yych <= '[') goto yy26;
-yy25: ++YYCURSOR;
- if(YYLIMIT == YYCURSOR) YYFILL(1);
- yych = *YYCURSOR;
- if(yych == '"') goto yy23;
- goto yy18;
-yy26: yych = *++YYCURSOR;
-yy27:
-#line 57
- { RET(PDO_PARSER_TEXT); }
-}
-#line 64
-
-}
-
-int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery,
- int *outquery_len TSRMLS_DC)
-{
- Scanner s;
- char *ptr;
- int t;
- int bindno = 0;
- int newbuffer_len;
- int padding;
- HashTable *params = stmt->bound_params;
- struct pdo_bound_param_data *param;
- /* allocate buffer for query with expanded binds, ptr is our writing pointer */
- newbuffer_len = inquery_len;
-
- /* calculate the possible padding factor due to quoting */
- if(stmt->dbh->max_escaped_char_length) {
- padding = stmt->dbh->max_escaped_char_length;
- } else {
- padding = 3;
- }
- if(params) {
- zend_hash_internal_pointer_reset(params);
- while (SUCCESS == zend_hash_get_current_data(params, (void**)&param)) {
- if(param->parameter) {
- convert_to_string(param->parameter);
- /* accomodate a string that needs to be fully quoted
- bind placeholders are at least 2 characters, so
- the accomodate their own "'s
- */
- newbuffer_len += padding * Z_STRLEN_P(param->parameter);
- }
- zend_hash_move_forward(params);
- }
- }
- *outquery = (char *) emalloc(newbuffer_len + 1);
- *outquery_len = 0;
-
- ptr = *outquery;
- s.cur = inquery;
- s.lim = inquery + inquery_len;
- while((t = scan(&s)) != PDO_PARSER_EOI) {
- if(t == PDO_PARSER_TEXT) {
- memcpy(ptr, s.tok, s.cur - s.tok);
- ptr += (s.cur - s.tok);
- *outquery_len += (s.cur - s.tok);
- }
- else if(t == PDO_PARSER_BIND) {
- if(!params) {
- /* error */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- /* lookup bind first via hash and then index */
- /* stupid keys need to be null-terminated, even though we know their length */
- if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok,(void **)&param))
- ||
- (SUCCESS == zend_hash_index_find(params, bindno, (void **)&param)))
- {
- char *quotedstr;
- int quotedstrlen;
- /* restore the in-string key, doesn't need null-termination here */
- /* currently everything is a string here */
-
- /* quote the bind value if necessary */
- if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
- {
- memcpy(ptr, quotedstr, quotedstrlen);
- ptr += quotedstrlen;
- *outquery_len += quotedstrlen;
- efree(quotedstr);
- } else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
- ptr += Z_STRLEN_P(param->parameter);
- *outquery_len += (Z_STRLEN_P(param->parameter));
- }
- }
- else {
- /* error and cleanup */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- bindno++;
- }
- else if(t == PDO_PARSER_BIND_POS) {
- if(!params) {
- /* error */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- /* lookup bind by index */
- if(SUCCESS == zend_hash_index_find(params, bindno, (void **)&param))
- {
- char *quotedstr;
- int quotedstrlen;
- /* currently everything is a string here */
-
- /* quote the bind value if necessary */
- if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
- {
- memcpy(ptr, quotedstr, quotedstrlen);
- ptr += quotedstrlen;
- *outquery_len += quotedstrlen;
- efree(quotedstr);
- } else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
- ptr += Z_STRLEN_P(param->parameter);
- *outquery_len += (Z_STRLEN_P(param->parameter));
- }
- }
- else {
- /* error and cleanup */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- bindno++;
- }
- }
- *ptr = '\0';
- return 0;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker ft=c
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
deleted file mode 100644
index 412f70ae06..0000000000
--- a/ext/pdo/pdo_sql_parser.re
+++ /dev/null
@@ -1,201 +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: George Schlossnagle <george@omniti.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include "php.h"
-#include "php_pdo_driver.h"
-
-#define PDO_PARSER_TEXT 1
-#define PDO_PARSER_BIND 2
-#define PDO_PARSER_BIND_POS 3
-#define PDO_PARSER_EOI 4
-
-#define RET(i) {s->cur = cursor; return i; }
-
-#define YYCTYPE char
-#define YYCURSOR cursor
-#define YYLIMIT s->lim
-#define YYMARKER s->ptr
-#define YYFILL(n)
-
-typedef struct Scanner {
- char *lim, *ptr, *cur, *tok;
-} Scanner;
-
-static int scan(Scanner *s)
-{
- char *cursor = s->cur;
- std:
- s->tok = cursor;
- /*!re2c
- BINDCHR = [:][a-zA-Z0-9_]+;
- QUESTION = [?];
- SPECIALS = [:?"'];
- ESCQQ = [\\]["];
- ESCQ = [\\]['];
- EOF = [\000];
- ANYNOEOF = [\001-\377];
- */
-
- /*!re2c
- (["] (ESCQQ|ANYNOEOF\[\\"])* ["]) { RET(PDO_PARSER_TEXT); }
- (['] (ESCQ|ANYNOEOF\[\\"])* [']) { RET(PDO_PARSER_TEXT); }
- BINDCHR { RET(PDO_PARSER_BIND); }
- QUESTION { RET(PDO_PARSER_BIND_POS); }
- SPECIALS { RET(PDO_PARSER_TEXT); }
- (ANYNOEOF\SPECIALS)+ { RET(PDO_PARSER_TEXT); }
- EOF { RET(PDO_PARSER_EOI); }
- */
-}
-
-int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery,
- int *outquery_len TSRMLS_DC)
-{
- Scanner s;
- char *ptr;
- int t;
- int bindno = 0;
- int newbuffer_len;
- int padding;
- HashTable *params = stmt->bound_params;
- struct pdo_bound_param_data *param;
- /* allocate buffer for query with expanded binds, ptr is our writing pointer */
- newbuffer_len = inquery_len;
-
- /* calculate the possible padding factor due to quoting */
- if(stmt->dbh->max_escaped_char_length) {
- padding = stmt->dbh->max_escaped_char_length;
- } else {
- padding = 3;
- }
- if(params) {
- zend_hash_internal_pointer_reset(params);
- while (SUCCESS == zend_hash_get_current_data(params, (void**)&param)) {
- if(param->parameter) {
- convert_to_string(param->parameter);
- /* accomodate a string that needs to be fully quoted
- bind placeholders are at least 2 characters, so
- the accomodate their own "'s
- */
- newbuffer_len += padding * Z_STRLEN_P(param->parameter);
- }
- zend_hash_move_forward(params);
- }
- }
- *outquery = (char *) emalloc(newbuffer_len + 1);
- *outquery_len = 0;
-
- ptr = *outquery;
- s.cur = inquery;
- s.lim = inquery + inquery_len;
- while((t = scan(&s)) != PDO_PARSER_EOI) {
- if(t == PDO_PARSER_TEXT) {
- memcpy(ptr, s.tok, s.cur - s.tok);
- ptr += (s.cur - s.tok);
- *outquery_len += (s.cur - s.tok);
- }
- else if(t == PDO_PARSER_BIND) {
- if(!params) {
- /* error */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- /* lookup bind first via hash and then index */
- /* stupid keys need to be null-terminated, even though we know their length */
- if((SUCCESS == zend_hash_find(params, s.tok, s.cur-s.tok,(void **)&param))
- ||
- (SUCCESS == zend_hash_index_find(params, bindno, (void **)&param)))
- {
- char *quotedstr;
- int quotedstrlen;
- /* restore the in-string key, doesn't need null-termination here */
- /* currently everything is a string here */
-
- /* quote the bind value if necessary */
- if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
- {
- memcpy(ptr, quotedstr, quotedstrlen);
- ptr += quotedstrlen;
- *outquery_len += quotedstrlen;
- efree(quotedstr);
- } else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
- ptr += Z_STRLEN_P(param->parameter);
- *outquery_len += (Z_STRLEN_P(param->parameter));
- }
- }
- else {
- /* error and cleanup */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- bindno++;
- }
- else if(t == PDO_PARSER_BIND_POS) {
- if(!params) {
- /* error */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- /* lookup bind by index */
- if(SUCCESS == zend_hash_index_find(params, bindno, (void **)&param))
- {
- char *quotedstr;
- int quotedstrlen;
- /* currently everything is a string here */
-
- /* quote the bind value if necessary */
- if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter),
- Z_STRLEN_P(param->parameter), &quotedstr, &quotedstrlen TSRMLS_CC))
- {
- memcpy(ptr, quotedstr, quotedstrlen);
- ptr += quotedstrlen;
- *outquery_len += quotedstrlen;
- efree(quotedstr);
- } else {
- memcpy(ptr, Z_STRVAL_P(param->parameter), Z_STRLEN_P(param->parameter));
- ptr += Z_STRLEN_P(param->parameter);
- *outquery_len += (Z_STRLEN_P(param->parameter));
- }
- }
- else {
- /* error and cleanup */
- efree(*outquery);
- *outquery = NULL;
- return (int) (s.cur - inquery);
- }
- bindno++;
- }
- }
- *ptr = '\0';
- return 0;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker ft=c
- * vim<600: noet sw=4 ts=4
- */
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
deleted file mode 100755
index 9992633319..0000000000
--- a/ext/pdo/pdo_stmt.c
+++ /dev/null
@@ -1,1106 +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: Wez Furlong <wez@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* The PDO Statement Handle Class */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_pdo.h"
-#include "php_pdo_driver.h"
-#include "php_pdo_int.h"
-#include "php_pdo_sql_parser.h"
-#include "zend_exceptions.h"
-
-#if COMPILE_DL_PDO
-/* {{{ content from zend_arg_defs.c:
- * since it is a .c file, it won't be installed for use by PECL extensions, so we include it here. */
-ZEND_BEGIN_ARG_INFO(first_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(1)
-ZEND_END_ARG_INFO();
-
-
-ZEND_BEGIN_ARG_INFO(second_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(1)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO(third_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(1)
-ZEND_END_ARG_INFO();
-
-
-ZEND_BEGIN_ARG_INFO(fourth_arg_force_ref, 0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(0)
- ZEND_ARG_PASS_INFO(1)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO(all_args_by_ref, 1)
-ZEND_END_ARG_INFO();
-/* }}} */
-#endif
-
-static PHP_FUNCTION(dbstmt_constructor) /* {{{ */
-{
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "You should not create a PDOStatement manually");
-}
-/* }}} */
-
-/* trigger callback hook for parameters */
-static int dispatch_param_event(pdo_stmt_t *stmt, enum pdo_param_event event_type TSRMLS_DC)
-{
- int ret = 1, is_param = 1;
- struct pdo_bound_param_data *param;
- HashTable *ht;
-
- if (!stmt->methods->param_hook) {
- return 1;
- }
-
- ht = stmt->bound_params;
-
-iterate:
- if (ht) {
- zend_hash_internal_pointer_reset(ht);
- while (SUCCESS == zend_hash_get_current_data(ht, (void**)&param)) {
-
- if (!stmt->methods->param_hook(stmt, param, event_type TSRMLS_CC)) {
- ret = 0;
- break;
- }
-
- zend_hash_move_forward(ht);
- }
- }
- if (ret && is_param) {
- ht = stmt->bound_columns;
- is_param = 0;
- goto iterate;
- }
-
- return ret;
-}
-
-static int describe_columns(pdo_stmt_t *stmt TSRMLS_DC)
-{
- int col;
-
- stmt->columns = ecalloc(stmt->column_count, sizeof(struct pdo_column_data));
-
- for (col = 0; col < stmt->column_count; col++) {
- if (!stmt->methods->describer(stmt, col TSRMLS_CC)) {
- return 0;
- }
-
- /* if we are applying case conversions on column names, do so now */
- if (stmt->dbh->native_case != stmt->dbh->desired_case && stmt->dbh->desired_case != PDO_CASE_NATURAL) {
- char *s = stmt->columns[col].name;
-
- switch (stmt->dbh->desired_case) {
- case PDO_CASE_UPPER:
- while (*s != '\0') {
- *s = toupper(*s);
- s++;
- }
- break;
- case PDO_CASE_LOWER:
- while (*s != '\0') {
- *s = tolower(*s);
- s++;
- }
- break;
- default:
- ;
- }
- }
-
- /* update the column index on named bound parameters */
- if (stmt->bound_params) {
- struct pdo_bound_param_data *param;
-
- if (SUCCESS == zend_hash_find(stmt->bound_params, stmt->columns[col].name,
- stmt->columns[col].namelen, (void**)&param)) {
- param->paramno = col;
- }
- }
- if (stmt->bound_columns) {
- struct pdo_bound_param_data *param;
-
- if (SUCCESS == zend_hash_find(stmt->bound_columns, stmt->columns[col].name,
- stmt->columns[col].namelen, (void**)&param)) {
- param->paramno = col;
- }
- }
-
- }
- return 1;
-}
-
-static void get_lazy_object(pdo_stmt_t *stmt, zval *return_value TSRMLS_DC)
-{
- if (Z_TYPE(stmt->lazy_object_ref) == IS_NULL) {
- Z_TYPE(stmt->lazy_object_ref) = IS_OBJECT;
- Z_OBJ_HANDLE(stmt->lazy_object_ref) = zend_objects_store_put(stmt, NULL, pdo_row_free_storage, NULL TSRMLS_CC);
- Z_OBJ_HT(stmt->lazy_object_ref) = &pdo_row_object_handlers;
- stmt->refcount++;
- }
- Z_TYPE_P(return_value) = IS_OBJECT;
- Z_OBJ_HANDLE_P(return_value) = Z_OBJ_HANDLE(stmt->lazy_object_ref);
- Z_OBJ_HT_P(return_value) = Z_OBJ_HT(stmt->lazy_object_ref);
-}
-
-static void param_dtor(void *data)
-{
- struct pdo_bound_param_data *param = (struct pdo_bound_param_data *)data;
- TSRMLS_FETCH();
-
- /* tell the driver that it is going away */
- if (param->stmt->methods->param_hook) {
- param->stmt->methods->param_hook(param->stmt, param, PDO_PARAM_EVT_FREE TSRMLS_CC);
- }
-
- if (param->name) {
- efree(param->name);
- }
-
- zval_ptr_dtor(&(param->parameter));
- if (param->driver_params) {
- zval_ptr_dtor(&(param->driver_params));
- }
-}
-
-static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_stmt_t *stmt, int is_param TSRMLS_DC)
-{
- HashTable *hash;
- struct pdo_bound_param_data *pparam = NULL;
-
- hash = is_param ? stmt->bound_params : stmt->bound_columns;
-
- if (!hash) {
- ALLOC_HASHTABLE(hash);
- zend_hash_init(hash, 13, NULL, param_dtor, 0);
-
- if (is_param) {
- stmt->bound_params = hash;
- } else {
- stmt->bound_columns = hash;
- }
- }
-
- if (param->param_type == PDO_PARAM_STR && param->max_value_len <= 0) {
- convert_to_string(param->parameter);
- /* XXX: need to provide a way to set this to something sane, or
- * investigate a better way to set the length of output parameters in
- * the drivers themselves */
- param->max_value_len = Z_STRLEN_P(param->parameter);
- }
-
- param->stmt = stmt;
- param->is_param = is_param;
-
- ZVAL_ADDREF(param->parameter);
- if (param->driver_params) {
- ZVAL_ADDREF(param->driver_params);
- }
-
- if (param->name && stmt->columns) {
- /* try to map the name to the column */
- int i;
-
- for (i = 0; i < stmt->column_count; i++) {
- if (strcmp(stmt->columns[i].name, param->name) == 0) {
- param->paramno = i;
- break;
- }
- }
-
- if (param->paramno == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Did not found column name '%s' in the defined columns; it will not be bound", param->name);
- }
- }
-
- if (param->name) {
- param->name = estrndup(param->name, param->namelen);
- zend_hash_update(hash, param->name, param->namelen, param, sizeof(*param), (void**)&pparam);
- } else {
- zend_hash_index_update(hash, param->paramno, param, sizeof(*param), (void**)&pparam);
- }
-
- /* tell the driver we just created a parameter */
- if (stmt->methods->param_hook) {
- return stmt->methods->param_hook(stmt, pparam, PDO_PARAM_EVT_ALLOC TSRMLS_CC);
- }
-
- return 1;
-}
-
-
-/* {{{ proto bool PDOStatement::execute([array $bound_input_params])
- Execute a prepared statement, optionally binding parameters */
-static PHP_METHOD(PDOStatement, execute)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
- zval *input_params = NULL;
- int ret = 1;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &input_params)) {
- RETURN_FALSE;
- }
-
- PDO_STMT_CLEAR_ERR();
-
- if (input_params) {
- struct pdo_bound_param_data param;
- zval **tmp;
- uint str_length;
- ulong num_index;
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(input_params));
- while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(input_params), (void*)&tmp)) {
- memset(&param, 0, sizeof(param));
-
- if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(input_params),
- &param.name, &str_length, &num_index, 0, NULL)) {
- /* yes this is correct. we don't want to count the null byte. ask wez */
- param.namelen = str_length - 1;
- param.paramno = -1;
- } else {
- /* we're okay to be zero based here */
- if (num_index < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter index");
- RETURN_FALSE;
- }
- param.paramno = num_index;
- }
-
- param.param_type = PDO_PARAM_STR;
- param.parameter = *tmp;
-
- if (!really_register_bound_param(&param, stmt, 1 TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- zend_hash_move_forward(Z_ARRVAL_P(input_params));
- }
- }
-
- if (!stmt->dbh->supports_placeholders) {
- int error_pos;
- /* handle the emulated parameter binding,
- * stmt->active_query_string holds the query with binds expanded and
- * quoted.
- */
- if((error_pos = pdo_parse_params(stmt, stmt->query_string, stmt->query_stringlen,
- &stmt->active_query_string, &stmt->active_query_stringlen)) != 0) {
- // parse error in handling the query
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error emulating placeholder binding in query at %.*s....", error_pos, stmt->query_string);
- RETURN_FALSE;
- }
- } else if (!dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_PRE TSRMLS_CC)) {
- RETURN_FALSE;
- }
- if (stmt->methods->executer(stmt TSRMLS_CC)) {
- if (stmt->active_query_string) {
- efree(stmt->active_query_string);
- stmt->active_query_string = NULL;
- }
- if (!stmt->executed) {
- /* this is the first execute */
-
- if (stmt->dbh->alloc_own_columns) {
- /* for "big boy" drivers, we need to allocate memory to fetch
- * the results into, so lets do that now */
- ret = describe_columns(stmt TSRMLS_CC);
- }
-
- stmt->executed = 1;
- }
-
- if (ret && !dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_POST TSRMLS_CC)) {
- RETURN_FALSE;
- }
-
- RETURN_BOOL(ret);
- }
- if (stmt->active_query_string) {
- efree(stmt->active_query_string);
- stmt->active_query_string = NULL;
- }
- PDO_HANDLE_STMT_ERR();
- RETURN_FALSE;
-}
-/* }}} */
-
-static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno TSRMLS_DC)
-{
- struct pdo_column_data *col;
- char *value = NULL;
- unsigned long value_len = 0;
-
- col = &stmt->columns[colno];
-
- value = NULL;
- value_len = 0;
-
- stmt->methods->get_col(stmt, colno, &value, &value_len TSRMLS_CC);
-
- switch (col->param_type) {
- case PDO_PARAM_STR:
- if (value) {
- ZVAL_STRINGL(dest, value, value_len, 1);
- break;
- }
- default:
- ZVAL_NULL(dest);
- }
-}
-
-static int do_fetch_common(pdo_stmt_t *stmt, int do_bind TSRMLS_DC)
-{
- if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_PRE TSRMLS_CC)) {
- return 0;
- }
-
- if (!stmt->methods->fetcher(stmt TSRMLS_CC)) {
- return 0;
- }
-
- /* some drivers might need to describe the columns now */
- if (!stmt->columns && !describe_columns(stmt TSRMLS_CC)) {
- return 0;
- }
-
- if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_POST TSRMLS_CC)) {
- return 0;
- }
-
- if (do_bind && stmt->bound_columns) {
- /* update those bound column variables now */
- struct pdo_bound_param_data *param;
-
- zend_hash_internal_pointer_reset(stmt->bound_columns);
- while (SUCCESS == zend_hash_get_current_data(stmt->bound_columns, (void**)&param)) {
- if (param->paramno >= 0) {
- convert_to_string(param->parameter);
-
- /* delete old value */
- zval_dtor(param->parameter);
-
- /* set new value */
- fetch_value(stmt, param->parameter, param->paramno TSRMLS_CC);
-
- /* TODO: some smart thing that avoids duplicating the value in the
- * general loop below. For now, if you're binding output columns,
- * it's better to use LAZY or BOUND fetches if you want to shave
- * off those cycles */
- }
-
- zend_hash_move_forward(stmt->bound_columns);
- }
- }
-
- return 1;
-}
-
-/* perform a fetch. If do_bind is true, update any bound columns.
- * If return_value is not null, store values into it according to HOW. */
-static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how TSRMLS_DC)
-{
- enum pdo_fetch_type really_how = how;
-
- if (!do_fetch_common(stmt, do_bind TSRMLS_CC)) {
- return 0;
- }
-
- if (return_value) {
- int i;
-
- if (how == PDO_FETCH_LAZY) {
- get_lazy_object(stmt, return_value TSRMLS_CC);
- return 1;
- }
-
- array_init(return_value);
-
- if (how == PDO_FETCH_OBJ) {
- how = PDO_FETCH_ASSOC;
- }
-
- for (i = 0; i < stmt->column_count; i++) {
- zval *val;
- MAKE_STD_ZVAL(val);
- fetch_value(stmt, val, i TSRMLS_CC);
-
- if (how == PDO_FETCH_ASSOC || how == PDO_FETCH_BOTH) {
- add_assoc_zval(return_value, stmt->columns[i].name, val);
- }
- if (how == PDO_FETCH_NUM || how == PDO_FETCH_BOTH) {
- add_next_index_zval(return_value, val);
- }
-
- if (how == PDO_FETCH_BOTH) {
- ZVAL_ADDREF(val);
- }
- }
-
- if (really_how == PDO_FETCH_OBJ) {
- object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value));
- }
- }
-
- return 1;
-}
-
-/* {{{ proto mixed PDOStatement::fetch([int $how = PDO_FETCH_BOTH])
- Fetches the next row and returns it, or false if there are no more rows */
-static PHP_METHOD(PDOStatement, fetch)
-{
- long how = PDO_FETCH_BOTH;
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &how)) {
- RETURN_FALSE;
- }
-
- PDO_STMT_CLEAR_ERR();
- if (!do_fetch(stmt, TRUE, return_value, how TSRMLS_CC)) {
- PDO_HANDLE_STMT_ERR();
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string PDOStatement::fetchSingle()
- Returns a data of the 1st column in the result set. */
-static PHP_METHOD(PDOStatement, fetchSingle)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS()) {
- RETURN_FALSE;
- }
-
- PDO_STMT_CLEAR_ERR();
- if (!do_fetch_common(stmt, TRUE TSRMLS_CC)) {
- PDO_HANDLE_STMT_ERR();
- RETURN_FALSE;
- }
-
- fetch_value(stmt, return_value, 0 TSRMLS_CC);
-}
-/* }}} */
-
-/* {{{ proto array PDOStatement::fetchAll([int $how = PDO_FETCH_BOTH])
- Returns an array of all of the results. */
-static PHP_METHOD(PDOStatement, fetchAll)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long how = PDO_FETCH_BOTH;
- zval *data;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &how)) {
- RETURN_FALSE;
- }
-
- PDO_STMT_CLEAR_ERR();
- MAKE_STD_ZVAL(data);
- if (!do_fetch(stmt, TRUE, data, how TSRMLS_CC)) {
- FREE_ZVAL(data);
- PDO_HANDLE_STMT_ERR();
- RETURN_FALSE;
- }
-
- array_init(return_value);
- do {
- add_next_index_zval(return_value, data);
- MAKE_STD_ZVAL(data);
- } while (do_fetch(stmt, TRUE, data, how TSRMLS_CC));
- FREE_ZVAL(data);
-}
-/* }}} */
-
-static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int is_param)
-{
- struct pdo_bound_param_data param = {0};
-
- param.paramno = -1;
- param.param_type = PDO_PARAM_STR;
-
- if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
- ZEND_NUM_ARGS() TSRMLS_CC, "sz|llz!",
- &param.name, &param.namelen, &param.parameter, &param.param_type,
- &param.max_value_len,
- &param.driver_params)) {
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|llz!", &param.paramno,
- &param.parameter, &param.param_type, &param.max_value_len, &param.driver_params)) {
- return 0;
- }
- }
-
- if (param.paramno > 0) {
- --param.paramno; /* make it zero-based internally */
- } else if (!param.name) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter number: columns are 1-based");
- return 0;
- }
-
- return really_register_bound_param(&param, stmt, is_param TSRMLS_CC);
-}
-
-/* {{{ proto bool PDOStatement::bindParam(mixed $paramno, mixed &$param [, int $type [, int $maxlen [, mixed $driverdata]]])
- bind a parameter to a PHP variable. $paramno is the 1-based position of the placeholder in the SQL statement (but can be the parameter name for drivers that support named placeholders). This isn't supported by all drivers. It should be called prior to execute(). */
-static PHP_METHOD(PDOStatement, bindParam)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_BOOL(register_bound_param(INTERNAL_FUNCTION_PARAM_PASSTHRU, stmt, TRUE));
-}
-/* }}} */
-
-/* {{{ proto bool PDOStatement::bindColumn(mixed $column, mixed &$param [, int $type [, int $maxlen [, mixed $driverdata]]])
- bind a column to a PHP variable. On each row fetch $param will contain the value of the corresponding column. $column is the 1-based offset of the column, or the column name. For portability, don't call this before execute(). */
-static PHP_METHOD(PDOStatement, bindColumn)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
- RETURN_BOOL(register_bound_param(INTERNAL_FUNCTION_PARAM_PASSTHRU, stmt, FALSE));
-}
-/* }}} */
-
-/* {{{ proto int PDOStatement::rowCount()
- Returns the number of rows in a result set, or the number of rows affected by the last execute(). It is not always meaningful. */
-static PHP_METHOD(PDOStatement, rowCount)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This statement is not a scrollable cursor and does not know the row count");
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int PDOStatement::errorCode()
- Fetch the error code associated with the last operation on the statement handle */
-static PHP_METHOD(PDOStatement, errorCode)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS()) {
- RETURN_FALSE;
- }
-
- RETURN_LONG(stmt->error_code);
-}
-/* }}} */
-
-/* {{{ proto int PDOStatement::errorInfo()
- Fetch extended error information associated with the last operation on the statement handle */
-static PHP_METHOD(PDOStatement, errorInfo)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS()) {
- RETURN_FALSE;
- }
-
- array_init(return_value);
- add_next_index_long(return_value, stmt->error_code);
-
- if (stmt->dbh->methods->fetch_err) {
- stmt->dbh->methods->fetch_err(stmt->dbh, stmt, return_value TSRMLS_CC);
- }
-}
-/* }}} */
-
-/* {{{ proto bool PDOStatement::setAttribute(long attribute, mixed value)
- Set an attribute */
-static PHP_METHOD(PDOStatement, setAttribute)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long attr;
- zval *value = NULL;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz!", &attr, &value)) {
- RETURN_FALSE;
- }
-
- if (!stmt->methods->set_attribute) {
- goto fail;
- }
-
- PDO_STMT_CLEAR_ERR();
- if (stmt->methods->set_attribute(stmt, attr, value TSRMLS_CC)) {
- RETURN_TRUE;
- }
-
-fail:
- if (!stmt->methods->set_attribute) {
- /* XXX: do something better here */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This driver doesn't support setting attributes");
- } else {
- PDO_HANDLE_STMT_ERR();
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto mixed PDOStatement::getAttribute(long attribute)
- Get an attribute */
-static PHP_METHOD(PDOStatement, getAttribute)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)zend_object_store_get_object(getThis() TSRMLS_CC);
- long attr;
-
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) {
- RETURN_FALSE;
- }
-
- if (!stmt->methods->get_attribute) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This driver doesn't support fetching attributes");
- RETURN_FALSE;
- }
-
- PDO_STMT_CLEAR_ERR();
- switch (stmt->methods->get_attribute(stmt, attr, return_value TSRMLS_CC)) {
- case -1:
- PDO_HANDLE_STMT_ERR();
- RETURN_FALSE;
-
- case 0:
- /* XXX: should do something better here */
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This driver doesn't support fetching %ld attribute", attr);
- break;
-
- default:
- return;
- }
-}
-/* }}} */
-
-function_entry pdo_dbstmt_functions[] = {
- PHP_ME(PDOStatement, execute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetch, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindParam, second_arg_force_ref, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindColumn, second_arg_force_ref, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, rowCount, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchSingle, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchAll, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, errorCode, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, errorInfo, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, setAttribute, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, getAttribute, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
-/* {{{ overloaded handlers for PDOStatement class */
-static zval *dbstmt_prop_read(zval *object, zval *member, int type TSRMLS_DC)
-{
- zval *return_value;
- pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object TSRMLS_CC);
-
- convert_to_string(member);
-
- if(strcmp(Z_STRVAL_P(member), "queryString") == 0) {
- MAKE_STD_ZVAL(return_value);
- ZVAL_STRINGL(return_value, stmt->query_string, stmt->query_stringlen, 1);
- } else {
- MAKE_STD_ZVAL(return_value);
- ZVAL_NULL(return_value);
- }
- return return_value;
-}
-
-static void dbstmt_prop_write(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- return;
-}
-
-static zval *dbstmt_read_dim(zval *object, zval *offset, int type TSRMLS_DC)
-{
- zval *return_value;
-
- MAKE_STD_ZVAL(return_value);
- ZVAL_NULL(return_value);
-
- return return_value;
-}
-
-static void dbstmt_write_dim(zval *object, zval *offset, zval *value TSRMLS_DC)
-{
- return;
-}
-
-static int dbstmt_prop_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- return 0;
-}
-
-static int dbstmt_dim_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- return 0;
-}
-
-static void dbstmt_prop_delete(zval *object, zval *offset TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot delete properties from a PDOStatement");
-}
-
-static void dbstmt_dim_delete(zval *object, zval *offset TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot delete dimensions from a PDOStatement");
-}
-
-static HashTable *dbstmt_get_properties(zval *object TSRMLS_DC)
-{
- return NULL;
-}
-
-static union _zend_function *dbstmt_method_get(zval *object, char *method_name, int method_len TSRMLS_DC)
-{
- zend_function *fbc;
- char *lc_method_name;
-
- lc_method_name = do_alloca(method_len + 1);
- zend_str_tolower_copy(lc_method_name, method_name, method_len);
-
- if (zend_hash_find(&pdo_dbstmt_ce->function_table, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) {
- free_alloca(lc_method_name);
- return NULL;
- }
-
- free_alloca(lc_method_name);
- return fbc;
-}
-
-static int dbstmt_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
-{
- return FAILURE;
-}
-
-static union _zend_function *dbstmt_get_ctor(zval *object TSRMLS_DC)
-{
- static zend_internal_function ctor = {0};
-
- ctor.type = ZEND_INTERNAL_FUNCTION;
- ctor.function_name = "__construct";
- ctor.scope = pdo_dbstmt_ce;
- ctor.handler = ZEND_FN(dbstmt_constructor);
-
- return (union _zend_function*)&ctor;
-}
-
-static zend_class_entry *dbstmt_get_ce(zval *object TSRMLS_DC)
-{
- return pdo_dbstmt_ce;
-}
-
-static int dbstmt_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
-{
- *class_name = estrndup("PDOStatement", sizeof("PDOStatement")-1);
- *class_name_len = sizeof("PDOStatement")-1;
- return 0;
-}
-
-static int dbstmt_compare(zval *object1, zval *object2 TSRMLS_DC)
-{
- return -1;
-}
-
-zend_object_handlers pdo_dbstmt_object_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
- dbstmt_prop_read,
- dbstmt_prop_write,
- dbstmt_read_dim,
- dbstmt_write_dim,
- NULL,
- NULL,
- NULL,
- dbstmt_prop_exists,
- dbstmt_prop_delete,
- dbstmt_dim_exists,
- dbstmt_dim_delete,
- dbstmt_get_properties,
- dbstmt_method_get,
- dbstmt_call_method,
- dbstmt_get_ctor,
- dbstmt_get_ce,
- dbstmt_get_classname,
- dbstmt_compare,
- NULL, /* cast */
- NULL
-};
-
-static void free_statement(pdo_stmt_t *stmt TSRMLS_DC)
-{
- if (stmt->methods && stmt->methods->dtor) {
- stmt->methods->dtor(stmt TSRMLS_CC);
- }
- if (stmt->query_string) {
- efree(stmt->query_string);
- }
-
- if (stmt->column_count) {
- int i;
- struct pdo_column_data *cols = stmt->columns;
-
- for (i = 0; i < stmt->column_count; i++) {
- efree(cols[i].name);
- }
- }
- if (stmt->columns) {
- efree(stmt->columns);
- }
-
- if (stmt->bound_params) {
- zend_hash_destroy(stmt->bound_params);
- FREE_HASHTABLE(stmt->bound_params);
- }
- if (stmt->bound_columns) {
- zend_hash_destroy(stmt->bound_columns);
- FREE_HASHTABLE(stmt->bound_columns);
- }
-
- zend_objects_store_del_ref(&stmt->database_object_handle TSRMLS_CC);
- efree(stmt);
-}
-
-void pdo_dbstmt_free_storage(zend_object *object TSRMLS_DC)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)object;
-
- if (--stmt->refcount == 0) {
- free_statement(stmt TSRMLS_CC);
- }
-}
-
-zend_object_value pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC)
-{
- zend_object_value retval;
-
- retval.handle = zend_objects_store_put(NULL, NULL, pdo_dbstmt_free_storage, NULL TSRMLS_CC);
- retval.handlers = &pdo_dbstmt_object_handlers;
-
- return retval;
-}
-/* }}} */
-
-/* {{{ overloaded handlers for PDORow class (used by PDO_FETCH_LAZY) */
-
-function_entry pdo_row_functions[] = {
- {NULL, NULL, NULL}
-};
-
-static zval *row_prop_or_dim_read(zval *object, zval *member, int type TSRMLS_DC)
-{
- zval *return_value;
- pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object TSRMLS_CC);
- int colno = -1;
-
- MAKE_STD_ZVAL(return_value);
-
- if (Z_TYPE_P(member) == IS_LONG) {
- if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) {
- fetch_value(stmt, return_value, Z_LVAL_P(member) TSRMLS_CC);
- }
- } else {
- convert_to_string(member);
- /* TODO: replace this with a hash of available column names to column
- * numbers */
- for (colno = 0; colno < stmt->column_count; colno++) {
- if (strcmp(stmt->columns[colno].name, Z_STRVAL_P(member)) == 0) {
- fetch_value(stmt, return_value, colno TSRMLS_CC);
- break;
- }
- }
- }
-
- return return_value;
-}
-
-static void row_prop_or_dim_write(zval *object, zval *member, zval *value TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This PDORow is not from a writable result set");
-}
-
-static int row_prop_or_dim_exists(zval *object, zval *member, int check_empty TSRMLS_DC)
-{
- pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object TSRMLS_CC);
- int colno = -1;
-
- if (Z_TYPE_P(member) == IS_LONG) {
- return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count;
- } else {
- convert_to_string(member);
-
- /* TODO: replace this with a hash of available column names to column
- * numbers */
- for (colno = 0; colno < stmt->column_count; colno++) {
- if (strcmp(stmt->columns[colno].name, Z_STRVAL_P(member)) == 0) {
- return 1;
- }
- }
- }
-
- return 0;
-}
-
-static void row_prop_or_dim_delete(zval *object, zval *offset TSRMLS_DC)
-{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot delete properties from a PDORow");
-}
-
-static HashTable *row_get_properties(zval *object TSRMLS_DC)
-{
- zval *tmp;
- pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object TSRMLS_CC);
- int i;
- HashTable *ht;
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
-
- for (i = 0; i < stmt->column_count; i++) {
- zval *val;
- MAKE_STD_ZVAL(val);
- fetch_value(stmt, val, i TSRMLS_CC);
-
- add_assoc_zval(tmp, stmt->columns[i].name, val);
- }
-
- ht = Z_ARRVAL_P(tmp);
-
- ZVAL_NULL(tmp);
- FREE_ZVAL(tmp);
-
- return ht;
-}
-
-static union _zend_function *row_method_get(zval *object, char *method_name, int method_len TSRMLS_DC)
-{
- zend_function *fbc;
- char *lc_method_name;
-
- lc_method_name = do_alloca(method_len + 1);
- zend_str_tolower_copy(lc_method_name, method_name, method_len);
-
- if (zend_hash_find(&pdo_row_ce->function_table, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) {
- free_alloca(lc_method_name);
- return NULL;
- }
-
- free_alloca(lc_method_name);
- return fbc;
-}
-
-static int row_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
-{
- return FAILURE;
-}
-
-static union _zend_function *row_get_ctor(zval *object TSRMLS_DC)
-{
- static zend_internal_function ctor = {0};
-
- ctor.type = ZEND_INTERNAL_FUNCTION;
- ctor.function_name = "__construct";
- ctor.scope = pdo_row_ce;
- ctor.handler = ZEND_FN(dbstmt_constructor);
-
- return (union _zend_function*)&ctor;
-}
-
-static zend_class_entry *row_get_ce(zval *object TSRMLS_DC)
-{
- return pdo_dbstmt_ce;
-}
-
-static int row_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
-{
- *class_name = estrndup("PDORow", sizeof("PDORow")-1);
- *class_name_len = sizeof("PDORow")-1;
- return 0;
-}
-
-static int row_compare(zval *object1, zval *object2 TSRMLS_DC)
-{
- return -1;
-}
-
-zend_object_handlers pdo_row_object_handlers = {
- ZEND_OBJECTS_STORE_HANDLERS,
- row_prop_or_dim_read,
- row_prop_or_dim_write,
- row_prop_or_dim_read,
- row_prop_or_dim_write,
- NULL,
- NULL,
- NULL,
- row_prop_or_dim_exists,
- row_prop_or_dim_delete,
- row_prop_or_dim_exists,
- row_prop_or_dim_delete,
- row_get_properties,
- row_method_get,
- row_call_method,
- row_get_ctor,
- row_get_ce,
- row_get_classname,
- row_compare,
- NULL, /* cast */
- NULL
-};
-
-void pdo_row_free_storage(zend_object *object TSRMLS_DC)
-{
- pdo_stmt_t *stmt = (pdo_stmt_t*)object;
-
- ZVAL_NULL(&stmt->lazy_object_ref);
-
- if (--stmt->refcount == 0) {
- free_statement(stmt TSRMLS_CC);
- }
-}
-
-zend_object_value pdo_row_new(zend_class_entry *ce TSRMLS_DC)
-{
- zend_object_value retval;
-
- retval.handle = zend_objects_store_put(NULL, NULL, pdo_row_free_storage, NULL TSRMLS_CC);
- retval.handlers = &pdo_row_object_handlers;
-
- return retval;
-}
-/* }}} */
-
-/*
- * 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/php_pdo.h b/ext/pdo/php_pdo.h
deleted file mode 100755
index a7fbd90894..0000000000
--- a/ext/pdo/php_pdo.h
+++ /dev/null
@@ -1,69 +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: Wez Furlong <wez@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDO_H
-#define PHP_PDO_H
-
-extern zend_module_entry pdo_module_entry;
-#define phpext_pdo_ptr &pdo_module_entry
-
-#ifdef PHP_WIN32
-# ifdef PDO_EXPORTS
-# define PDO_API __declspec(dllexport)
-# elif defined(COMPILE_DL_PDO)
-# define PDO_API __declspec(dllimport)
-# else
-# define PDO_API /* nothing special */
-# endif
-#else
-# define PDO_API /* nothing special */
-#endif
-
-#ifdef ZTS
-# include "TSRM.h"
-#endif
-
-PHP_MINIT_FUNCTION(pdo);
-PHP_MSHUTDOWN_FUNCTION(pdo);
-PHP_RINIT_FUNCTION(pdo);
-PHP_RSHUTDOWN_FUNCTION(pdo);
-PHP_MINFO_FUNCTION(pdo);
-
-ZEND_BEGIN_MODULE_GLOBALS(pdo)
- long global_value;
-ZEND_END_MODULE_GLOBALS(pdo)
-
-#ifdef ZTS
-# define PDOG(v) TSRMG(pdo_globals_id, zend_pdo_globals *, v)
-#else
-# define PDOG(v) (pdo_globals.v)
-#endif
-
-#endif /* PHP_PDO_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/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
deleted file mode 100755
index a0f9ac16ab..0000000000
--- a/ext/pdo/php_pdo_driver.h
+++ /dev/null
@@ -1,411 +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: Wez Furlong <wez@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDO_DRIVER_H
-#define PHP_PDO_DRIVER_H
-
-#include "php_pdo.h"
-
-/* forward declarations */
-typedef struct _pdo_dbh_t pdo_dbh_t;
-typedef struct _pdo_stmt_t pdo_stmt_t;
-struct pdo_bound_param_data;
-
-#ifndef TRUE
-# define TRUE 1
-#endif
-#ifndef FALSE
-# define FALSE 0
-#endif
-
-#define PDO_DRIVER_API 20040513
-
-enum pdo_param_type {
- PDO_PARAM_NULL,
- PDO_PARAM_INT,
- PDO_PARAM_STR,
- PDO_PARAM_LOB,
- PDO_PARAM_STMT, /* hierarchical result set */
-};
-
-enum pdo_fetch_type {
- PDO_FETCH_LAZY,
- PDO_FETCH_ASSOC,
- PDO_FETCH_NUM,
- PDO_FETCH_BOTH,
- PDO_FETCH_OBJ,
- PDO_FETCH_BOUND, /* return true/false only; rely on bound columns */
-};
-
-enum pdo_attribute_type {
- PDO_ATTR_AUTOCOMMIT, /* use to turn on or off auto-commit mode */
- PDO_ATTR_SCROLL, /* ask for a scrollable cursor (when you prepare()) */
- PDO_ATTR_PREFETCH, /* configure the prefetch size for drivers that support it */
- PDO_ATTR_TIMEOUT, /* connection timeout in seconds */
- PDO_ATTR_ERRMODE, /* control how errors are handled */
- PDO_ATTR_SERVER_VERSION, /* database server version */
- PDO_ATTR_CLIENT_VERSION, /* client library version */
- PDO_ATTR_SERVER_INFO, /* server information */
- PDO_ATTR_CONNECTION_STATUS, /* connection status */
- PDO_ATTR_CASE, /* control case folding for portability */
- PDO_ATTR_CURSOR_NAME, /* name a cursor for use in "WHERE CURRENT OF <name>" */
- PDO_ATTR_CURSOR, /* cursor type */
-
- /* this defines the start of the range for driver specific options.
- * Drivers should define their own attribute constants beginning with this
- * value. */
- PDO_ATTR_DRIVER_SPECIFIC = 1000
-};
-
-enum pdo_cursor_type {
- PDO_CURSOR_FWDONLY, /* forward only cursor (default) */
- PDO_CURSOR_SCROLL, /* scrollable cursor */
-};
-
-/* generic error code values.
- * Don't want to go overboard with these.
- * */
-enum pdo_error_type {
- PDO_ERR_NONE, /* no error condition */
- PDO_ERR_CANT_MAP, /* no way to map native error to the generic codes; consult the native error for more info */
- PDO_ERR_SYNTAX,
- PDO_ERR_CONSTRAINT,
- PDO_ERR_NOT_FOUND,
- PDO_ERR_ALREADY_EXISTS,
- PDO_ERR_NOT_IMPLEMENTED,
- PDO_ERR_MISMATCH,
- PDO_ERR_TRUNCATED,
- PDO_ERR_DISCONNECTED,
-};
-
-enum pdo_error_mode {
- PDO_ERRMODE_SILENT, /* just set error codes */
- PDO_ERRMODE_WARNING, /* raise E_WARNING */
- PDO_ERRMODE_EXCEPTION, /* throw exceptions */
-};
-
-enum pdo_case_conversion {
- PDO_CASE_NATURAL,
- PDO_CASE_UPPER,
- PDO_CASE_LOWER
-};
-
-/* {{{ utils for reading attributes set as driver_options */
-static inline long pdo_attr_lval(zval *options, enum pdo_fetch_type option_name, long defval TSRMLS_DC)
-{
- zval **v;
-
- if (options && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), option_name, (void**)&v)) {
- convert_to_long_ex(v);
- return Z_LVAL_PP(v);
- }
- return defval;
-}
-/* }}} */
-
-/* This structure is registered with PDO when a PDO driver extension is
- * initialized */
-typedef struct {
- const char *driver_name;
- unsigned long driver_name_len;
- unsigned long api_version; /* needs to be compatible with PDO */
-
-#define PDO_DRIVER_HEADER(name) \
- #name, sizeof(#name)-1, \
- PDO_DRIVER_API
-
- /* create driver specific portion of the database handle and stash it into
- * the dbh. dbh contains the data source string and flags for this
- * instance */
- int (*db_handle_factory)(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC);
-
-} pdo_driver_t;
-
-/* {{{ methods for a database handle */
-
-/* close or otherwise disconnect the database */
-typedef int (*pdo_dbh_close_func)(pdo_dbh_t *dbh TSRMLS_DC);
-
-/* prepare a statement and stash driver specific portion into stmt */
-typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, long options, zval *driver_options TSRMLS_DC);
-
-/* execute a statement (that does not return a result set) */
-typedef long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC);
-
-/* quote a string */
-typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen TSRMLS_DC);
-
-/* transaction related */
-typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh TSRMLS_DC);
-
-/* setting of attributes */
-typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC);
-
-/* return last insert id */
-typedef long (*pdo_dbh_last_id_func)(pdo_dbh_t *dbh TSRMLS_DC);
-
-/* fetch error information. if stmt is not null, fetch information pertaining
- * to the statement, otherwise fetch global error information. The driver
- * should add the following information to the array "info" in this order:
- * - native error code
- * - string representation of the error code ... any other optional driver
- * specific data ... */
-typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC);
-
-/* fetching of attributes */
-typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC);
-
-struct pdo_dbh_methods {
- pdo_dbh_close_func closer;
- pdo_dbh_prepare_func preparer;
- pdo_dbh_do_func doer;
- pdo_dbh_quote_func quoter;
- pdo_dbh_txn_func begin;
- pdo_dbh_txn_func commit;
- pdo_dbh_txn_func rollback;
- pdo_dbh_set_attr_func set_attribute;
- pdo_dbh_last_id_func last_id;
- pdo_dbh_fetch_error_func fetch_err;
- pdo_dbh_get_attr_func get_attribute;
-};
-
-/* }}} */
-
-/* {{{ methods for a statement handle */
-
-/* free the statement handle */
-typedef int (*pdo_stmt_dtor_func)(pdo_stmt_t *stmt TSRMLS_DC);
-
-/* start the query */
-typedef int (*pdo_stmt_execute_func)(pdo_stmt_t *stmt TSRMLS_DC);
-
-/* causes the next row in the set to be fetched; indicates if there are no
- * more rows */
-typedef int (*pdo_stmt_fetch_func)(pdo_stmt_t *stmt TSRMLS_DC);
-
-/* queries information about the type of a column, by index (0 based).
- * Driver should populate stmt->columns[colno] with appropriate info */
-typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC);
-
-/* retrieves pointer and size of the value for a column */
-typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, unsigned long *len TSRMLS_DC);
-
-/* hook for bound params */
-enum pdo_param_event {
- PDO_PARAM_EVT_ALLOC,
- PDO_PARAM_EVT_FREE,
- PDO_PARAM_EVT_EXEC_PRE,
- PDO_PARAM_EVT_EXEC_POST,
- PDO_PARAM_EVT_FETCH_PRE,
- PDO_PARAM_EVT_FETCH_POST,
-};
-
-typedef int (*pdo_stmt_param_hook_func)(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type TSRMLS_DC);
-
-/* setting of attributes */
-typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC);
-
-/* fetching of attributes */
-typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, long attr, zval *val TSRMLS_DC);
-
-
-struct pdo_stmt_methods {
- pdo_stmt_dtor_func dtor;
- pdo_stmt_execute_func executer;
- pdo_stmt_fetch_func fetcher;
- pdo_stmt_describe_col_func describer;
- pdo_stmt_get_col_data_func get_col;
- pdo_stmt_param_hook_func param_hook;
- pdo_stmt_set_attr_func set_attribute;
- pdo_stmt_get_attr_func get_attribute;
-};
-
-/* }}} */
-
-enum pdo_placeholder_support {
- PDO_PLACEHOLDER_NONE=0,
- PDO_PLACEHOLDER_NAMED=1,
- PDO_PLACEHOLDER_POSITIONAL=2
-};
-
-/* represents a connection to a database */
-struct _pdo_dbh_t {
- /* driver specific methods */
- struct pdo_dbh_methods *methods;
- /* driver specific data */
- void *driver_data;
-
- /* credentials */
- char *username, *password;
-
- /* if true, then data stored and pointed at by this handle must all be
- * persistently allocated */
- unsigned is_persistent:1;
-
- /* if true, driver should act as though a COMMIT were executed between
- * each executed statement; otherwise, COMMIT must be carried out manually
- * */
- unsigned auto_commit:1;
-
- /* if true, the handle has been closed and will not function anymore */
- unsigned is_closed:1;
-
- /* if true, the driver requires that memory be allocated explicitly for
- * the columns that are returned */
- unsigned alloc_own_columns:1;
-
- /* if true, the driver supports placeholders and can implement
- * bindParam() for its prepared statements, if false, PDO should
- * emulate prepare and bind on its behalf */
- unsigned supports_placeholders:2;
-
- /* if true, commit or rollBack is allowed to be called */
- unsigned in_txn:1;
-
- /* max length a single character can become after correct quoting */
- unsigned max_escaped_char_length:3;
-
- /* the sum of the number of bits here and the bit fields preceeding should
- * equal 32 */
- unsigned _reserved_flags:22;
-
- /* data source string used to open this handle */
- const char *data_source;
- unsigned long data_source_len;
-
- /* the global error code. */
- enum pdo_error_type error_code;
-
- enum pdo_error_mode error_mode;
-
- enum pdo_case_conversion native_case, desired_case;
-#if 0
- /* persistent hash key associated with this handle */
- const char *persistent_id;
- /* and the list id associated with it */
- int persistent_rsrc_id;
-#endif
-};
-
-/* describes a column */
-struct pdo_column_data {
- char *name;
- long namelen;
- unsigned long maxlen;
- enum pdo_param_type param_type;
- unsigned long precision;
-};
-
-/* describes a bound parameter */
-struct pdo_bound_param_data {
- long paramno; /* if -1, then it has a name, and we don't know the index *yet* */
- char *name;
- long namelen;
-
- long max_value_len; /* as a hint for pre-allocation */
-
- zval *parameter; /* the variable itself */
- enum pdo_param_type param_type; /* desired or suggested type */
-
- zval *driver_params; /* optional parameter(s) for the driver */
- void *driver_data;
-
- pdo_stmt_t *stmt; /* for convenience in dtor */
- int is_param; /* parameter or column ? */
-};
-
-/* represents a prepared statement */
-struct _pdo_stmt_t {
- /* driver specifics */
- struct pdo_stmt_methods *methods;
- void *driver_data;
-
- /* if true, we've already successfully executed this statement at least
- * once */
- unsigned executed:1;
- unsigned _reserved:31;
-
- /* the number of columns in the result set; not valid until after
- * the statement has been executed at least once. In some cases, might
- * not be valid until fetch (at the driver level) has been called at least once.
- * */
- int column_count;
- struct pdo_column_data *columns;
-
- /* we want to keep the dbh alive while we live, so we own a reference */
- zval database_object_handle;
- pdo_dbh_t *dbh;
-
- /* keep track of bound input parameters. Some drivers support
- * input/output parameters, but you can't rely on that working */
- HashTable *bound_params;
- /* keep track of PHP variables bound to named (or positional) columns
- * in the result set */
- HashTable *bound_columns;
-
- /* not always meaningful */
- long row_count;
-
- /* used to hold the statement's current query */
- char *query_string;
- int query_stringlen;
-
- /* the copy of the query with expanded binds ONLY for emulated-prepare drivers */
- char *active_query_string;
- int active_query_stringlen;
-
- /* the cursor specific error code. */
- enum pdo_error_type error_code;
-
- /* for lazy fetches, we always return the same lazy object handle.
- * Let's keep it here. */
- zval lazy_object_ref;
- unsigned long refcount;
-};
-
-/* call this in MINIT to register your PDO driver */
-PDO_API int php_pdo_register_driver(pdo_driver_t *driver);
-/* call this in MSHUTDOWN to unregister your PDO driver */
-PDO_API void php_pdo_unregister_driver(pdo_driver_t *driver);
-
-/* For the convenience of drivers, this function will parse a data source
- * string, of the form "name=value; name2=value2" and populate variables
- * according to the data you pass in and array of pdo_data_src_parser structures */
-struct pdo_data_src_parser {
- const char *optname;
- char *optval;
- int freeme;
-};
-
-PDO_API int php_pdo_parse_data_source(const char *data_source,
- unsigned long data_source_len, struct pdo_data_src_parser *parsed,
- int nparams);
-
-PDO_API zend_class_entry *php_pdo_get_exception(void);
-
-#endif /* PHP_PDO_DRIVER_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/php_pdo_int.h b/ext/pdo/php_pdo_int.h
deleted file mode 100755
index 882ee904e1..0000000000
--- a/ext/pdo/php_pdo_int.h
+++ /dev/null
@@ -1,61 +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: Wez Furlong <wez@php.net> |
- | Marcus Boerger <helly@php.net> |
- | Sterling Hughes <sterling@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-/* Stuff private to the PDO extension and not for consumption by PDO drivers
- * */
-extern zend_class_entry *pdo_exception_ce;
-
-extern zend_object_value pdo_dbh_new(zend_class_entry *ce TSRMLS_DC);
-extern function_entry pdo_dbh_functions[];
-extern zend_class_entry *pdo_dbh_ce;
-
-extern zend_object_value pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC);
-extern function_entry pdo_dbstmt_functions[];
-extern zend_class_entry *pdo_dbstmt_ce;
-void pdo_dbstmt_free_storage(zend_object *object TSRMLS_DC);
-extern zend_object_handlers pdo_dbstmt_object_handlers;
-
-extern zend_object_value pdo_row_new(zend_class_entry *ce TSRMLS_DC);
-extern function_entry pdo_row_functions[];
-extern zend_class_entry *pdo_row_ce;
-void pdo_row_free_storage(zend_object *object TSRMLS_DC);
-extern zend_object_handlers pdo_row_object_handlers;
-
-
-extern pdo_driver_t *pdo_find_driver(const char *name, int namelen);
-
-extern void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC);
-
-#define PDO_DBH_CLEAR_ERR() dbh->error_code = PDO_ERR_NONE
-#define PDO_STMT_CLEAR_ERR() stmt->error_code = PDO_ERR_NONE
-#define PDO_HANDLE_DBH_ERR() if (dbh->error_code) { pdo_handle_error(dbh, NULL TSRMLS_CC); }
-#define PDO_HANDLE_STMT_ERR() if (stmt->error_code) { pdo_handle_error(stmt->dbh, stmt TSRMLS_CC); }
-
-
-/*
- * 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/php_pdo_sql_parser.h b/ext/pdo/php_pdo_sql_parser.h
deleted file mode 100644
index 4bb92cc212..0000000000
--- a/ext/pdo/php_pdo_sql_parser.h
+++ /dev/null
@@ -1,27 +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: George Schlossnagle <george@omniti.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#ifndef PHP_PDO_MYSQL_SQL_PARSER_H
-#define PHP_PDO_MYSQL_SQL_PARSER_H
-#include "php.h"
-int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery,
- int *outquery_len);
-
-#endif