summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xext/pdo/pdo.c83
-rwxr-xr-xext/pdo/pdo_dbh.c84
-rwxr-xr-xext/pdo/php_pdo.h12
-rw-r--r--ext/pdo/tests/pdo_001.phpt4
-rw-r--r--ext/pdo/tests/pdo_002.phpt4
-rw-r--r--ext/pdo/tests/pdo_003.phpt4
-rw-r--r--ext/pdo/tests/pdo_004.phpt4
-rw-r--r--ext/pdo/tests/pdo_005.phpt8
-rw-r--r--ext/pdo/tests/pdo_006.phpt6
-rw-r--r--ext/pdo/tests/pdo_007.phpt6
-rw-r--r--ext/pdo/tests/pdo_008.phpt4
-rw-r--r--ext/pdo/tests/pdo_009.phpt6
-rw-r--r--ext/pdo/tests/pdo_010.phpt6
-rw-r--r--ext/pdo/tests/pdo_011.phpt14
-rw-r--r--ext/pdo/tests/pdo_012.phpt8
-rw-r--r--ext/pdo/tests/pdo_013.phpt6
-rw-r--r--ext/pdo/tests/pdo_014.phpt6
-rw-r--r--ext/pdo/tests/pdo_015.phpt18
-rw-r--r--ext/pdo/tests/pdo_016.phpt16
-rwxr-xr-xext/pdo/tests/pdo_016a.phpt16
-rw-r--r--ext/pdo/tests/pdo_017.phpt4
-rw-r--r--ext/pdo/tests/pdo_018.phpt14
-rw-r--r--ext/pdo/tests/pdo_019.phpt4
-rw-r--r--ext/pdo/tests/pdo_023.phpt4
-rw-r--r--ext/pdo/tests/pdo_025.phpt6
-rw-r--r--ext/pdo/tests/pdo_026.phpt4
-rw-r--r--ext/pdo/tests/pdo_027.phpt4
-rw-r--r--ext/pdo/tests/pdo_test.inc6
-rwxr-xr-xext/pdo_mysql/pdo_mysql.c2
-rw-r--r--ext/pdo_pgsql/pdo_pgsql.c2
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c2
31 files changed, 191 insertions, 176 deletions
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index 1a92d504a3..2518e92520 100755
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -302,89 +302,6 @@ PHP_MINIT_FUNCTION(pdo)
le_ppdo = zend_register_list_destructors_ex(NULL, php_pdo_pdbh_dtor,
"PDO persistent database", module_number);
- REGISTER_LONG_CONSTANT("PDO_PARAM_BOOL", (long)PDO_PARAM_BOOL, CONST_CS|CONST_PERSISTENT);
- 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_PARAM_INPUT_OUTPUT", (long)PDO_PARAM_INPUT_OUTPUT, 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_FETCH_BOUND",(long)PDO_FETCH_BOUND, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_COLUMN",(long)PDO_FETCH_COLUMN, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_CLASS",(long)PDO_FETCH_CLASS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_INTO", (long)PDO_FETCH_INTO, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_FUNC", (long)PDO_FETCH_FUNC, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_GROUP",(long)PDO_FETCH_GROUP, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE, CONST_CS|CONST_PERSISTENT);
-#if PHP_MAJOR_VERSION > 5 || PHP_MINOR_VERSION >= 1
- REGISTER_LONG_CONSTANT("PDO_FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE, CONST_CS|CONST_PERSISTENT);
-#endif
- REGISTER_LONG_CONSTANT("PDO_FETCH_NAMED",(long)PDO_FETCH_NAMED, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_ATTR_AUTOCOMMIT", (long)PDO_ATTR_AUTOCOMMIT, 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_ATTR_ORACLE_NULLS", (long)PDO_ATTR_ORACLE_NULLS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_PERSISTENT", (long)PDO_ATTR_PERSISTENT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_STATEMENT_CLASS", (long)PDO_ATTR_STATEMENT_CLASS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_FETCH_TABLE_NAMES", (long)PDO_ATTR_FETCH_TABLE_NAMES, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_FETCH_CATALOG_NAMES", (long)PDO_ATTR_FETCH_CATALOG_NAMES, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_DRIVER_NAME", (long)PDO_ATTR_DRIVER_NAME, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_STRINGIFY_FETCHES",(long)PDO_ATTR_STRINGIFY_FETCHES, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_ATTR_MAX_COLUMN_LEN",(long)PDO_ATTR_MAX_COLUMN_LEN, 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_NULL_NATURAL", (long)PDO_NULL_NATURAL, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_NULL_EMPTY_STRING", (long)PDO_NULL_EMPTY_STRING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_NULL_TO_STRING", (long)PDO_NULL_TO_STRING, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_STRING_CONSTANT("PDO_ERR_NONE", PDO_ERR_NONE, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_NEXT", (long)PDO_FETCH_ORI_NEXT, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_PRIOR", (long)PDO_FETCH_ORI_PRIOR, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_FIRST", (long)PDO_FETCH_ORI_FIRST, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_LAST", (long)PDO_FETCH_ORI_LAST, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_ABS", (long)PDO_FETCH_ORI_ABS, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_FETCH_ORI_REL", (long)PDO_FETCH_ORI_REL, CONST_CS|CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("PDO_CURSOR_FWDONLY", (long)PDO_CURSOR_FWDONLY,CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("PDO_CURSOR_SCROLL", (long)PDO_CURSOR_SCROLL,CONST_CS|CONST_PERSISTENT);
-
-#if 0
- 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);
- REGISTER_LONG_CONSTANT("PDO_ERR_NO_PERM", (long)PDO_ERR_NO_PERM, CONST_CS|CONST_PERSISTENT);
-#endif
-
INIT_CLASS_ENTRY(ce, "PDOException", NULL);
#if can_handle_soft_dependency_on_SPL && defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
pdo_exception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException, NULL TSRMLS_CC);
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index b560c5f879..c3103c8a71 100755
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -1125,6 +1125,90 @@ void pdo_dbh_init(TSRMLS_D)
memcpy(&pdo_dbh_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
pdo_dbh_object_handlers.get_method = dbh_method_get;
pdo_dbh_object_handlers.compare_objects = dbh_compare;
+
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (long)PDO_PARAM_BOOL);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_NULL", (long)PDO_PARAM_NULL);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_INT", (long)PDO_PARAM_INT);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_STR", (long)PDO_PARAM_STR);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_LOB", (long)PDO_PARAM_LOB);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_STMT", (long)PDO_PARAM_STMT);
+ REGISTER_PDO_CLASS_CONST_LONG("PARAM_INPUT_OUTPUT", (long)PDO_PARAM_INPUT_OUTPUT);
+
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_LAZY", (long)PDO_FETCH_LAZY);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ASSOC",(long)PDO_FETCH_ASSOC);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_NUM", (long)PDO_FETCH_NUM);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOTH", (long)PDO_FETCH_BOTH);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_OBJ", (long)PDO_FETCH_OBJ);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_BOUND",(long)PDO_FETCH_BOUND);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_COLUMN",(long)PDO_FETCH_COLUMN);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASS",(long)PDO_FETCH_CLASS);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_INTO", (long)PDO_FETCH_INTO);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_FUNC", (long)PDO_FETCH_FUNC);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_GROUP",(long)PDO_FETCH_GROUP);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_UNIQUE",(long)PDO_FETCH_UNIQUE);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_CLASSTYPE",(long)PDO_FETCH_CLASSTYPE);
+#if PHP_MAJOR_VERSION > 5 || PHP_MINOR_VERSION >= 1
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_SERIALIZE",(long)PDO_FETCH_SERIALIZE);
+#endif
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_NAMED",(long)PDO_FETCH_NAMED);
+
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_AUTOCOMMIT", (long)PDO_ATTR_AUTOCOMMIT);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_PREFETCH", (long)PDO_ATTR_PREFETCH);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_TIMEOUT", (long)PDO_ATTR_TIMEOUT);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_ERRMODE", (long)PDO_ATTR_ERRMODE);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_VERSION", (long)PDO_ATTR_SERVER_VERSION);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CLIENT_VERSION", (long)PDO_ATTR_CLIENT_VERSION);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_SERVER_INFO", (long)PDO_ATTR_SERVER_INFO);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CONNECTION_STATUS", (long)PDO_ATTR_CONNECTION_STATUS);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CASE", (long)PDO_ATTR_CASE);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR_NAME", (long)PDO_ATTR_CURSOR_NAME);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_CURSOR", (long)PDO_ATTR_CURSOR);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_ORACLE_NULLS", (long)PDO_ATTR_ORACLE_NULLS);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_PERSISTENT", (long)PDO_ATTR_PERSISTENT);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_STATEMENT_CLASS", (long)PDO_ATTR_STATEMENT_CLASS);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_TABLE_NAMES", (long)PDO_ATTR_FETCH_TABLE_NAMES);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_FETCH_CATALOG_NAMES", (long)PDO_ATTR_FETCH_CATALOG_NAMES);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_DRIVER_NAME", (long)PDO_ATTR_DRIVER_NAME);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_STRINGIFY_FETCHES",(long)PDO_ATTR_STRINGIFY_FETCHES);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_MAX_COLUMN_LEN",(long)PDO_ATTR_MAX_COLUMN_LEN);
+
+ REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_SILENT", (long)PDO_ERRMODE_SILENT);
+ REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_WARNING", (long)PDO_ERRMODE_WARNING);
+ REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_EXCEPTION", (long)PDO_ERRMODE_EXCEPTION);
+
+ REGISTER_PDO_CLASS_CONST_LONG("CASE_NATURAL", (long)PDO_CASE_NATURAL);
+ REGISTER_PDO_CLASS_CONST_LONG("CASE_LOWER", (long)PDO_CASE_LOWER);
+ REGISTER_PDO_CLASS_CONST_LONG("CASE_UPPER", (long)PDO_CASE_UPPER);
+
+ REGISTER_PDO_CLASS_CONST_LONG("NULL_NATURAL", (long)PDO_NULL_NATURAL);
+ REGISTER_PDO_CLASS_CONST_LONG("NULL_EMPTY_STRING", (long)PDO_NULL_EMPTY_STRING);
+ REGISTER_PDO_CLASS_CONST_LONG("NULL_TO_STRING", (long)PDO_NULL_TO_STRING);
+
+ REGISTER_PDO_CLASS_CONST_STRING("ERR_NONE", PDO_ERR_NONE);
+
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_NEXT", (long)PDO_FETCH_ORI_NEXT);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_PRIOR", (long)PDO_FETCH_ORI_PRIOR);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_FIRST", (long)PDO_FETCH_ORI_FIRST);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_LAST", (long)PDO_FETCH_ORI_LAST);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_ABS", (long)PDO_FETCH_ORI_ABS);
+ REGISTER_PDO_CLASS_CONST_LONG("FETCH_ORI_REL", (long)PDO_FETCH_ORI_REL);
+
+ REGISTER_PDO_CLASS_CONST_LONG("CURSOR_FWDONLY", (long)PDO_CURSOR_FWDONLY);
+ REGISTER_PDO_CLASS_CONST_LONG("CURSOR_SCROLL", (long)PDO_CURSOR_SCROLL);
+
+#if 0
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_CANT_MAP", (long)PDO_ERR_CANT_MAP);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_SYNTAX", (long)PDO_ERR_SYNTAX);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_CONSTRAINT", (long)PDO_ERR_CONSTRAINT);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_FOUND", (long)PDO_ERR_NOT_FOUND);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_ALREADY_EXISTS", (long)PDO_ERR_ALREADY_EXISTS);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_IMPLEMENTED", (long)PDO_ERR_NOT_IMPLEMENTED);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_MISMATCH", (long)PDO_ERR_MISMATCH);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_TRUNCATED", (long)PDO_ERR_TRUNCATED);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_DISCONNECTED", (long)PDO_ERR_DISCONNECTED);
+ REGISTER_PDO_CLASS_CONST_LONG("ERR_NO_PERM", (long)PDO_ERR_NO_PERM);
+#endif
+
}
static void dbh_free(pdo_dbh_t *dbh TSRMLS_DC)
diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h
index c9fbb5606c..ba63cbfb97 100755
--- a/ext/pdo/php_pdo.h
+++ b/ext/pdo/php_pdo.h
@@ -58,6 +58,18 @@ ZEND_END_MODULE_GLOBALS(pdo)
# define PDOG(v) (pdo_globals.v)
#endif
+#define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
+ zend_declare_class_constant_long(pdo_dbh_ce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
+
+#define REGISTER_PDO_CONST_LONG(const_name, value) { \
+ zend_class_entry **pce; \
+ if (zend_hash_find(CG(class_table), "pdo", sizeof("pdo"), (void **) &pce) != FAILURE) \
+ zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \
+} \
+
+#define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
+ zend_declare_class_constant_stringl(pdo_dbh_ce, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
+
#endif /* PHP_PDO_H */
diff --git a/ext/pdo/tests/pdo_001.phpt b/ext/pdo/tests/pdo_001.phpt
index cf2013bfce..a3fca65406 100644
--- a/ext/pdo/tests/pdo_001.phpt
+++ b/ext/pdo/tests/pdo_001.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_ASSOC
+PDO Common: PDO::FETCH_ASSOC
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,7 +21,7 @@ $db->exec("INSERT INTO test VALUES(3, 'C')");
$stmt = $db->prepare('SELECT * from test');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_ASSOC));
+var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
?>
--EXPECT--
array(3) {
diff --git a/ext/pdo/tests/pdo_002.phpt b/ext/pdo/tests/pdo_002.phpt
index 3dbdff2945..56a5e4d2ef 100644
--- a/ext/pdo/tests/pdo_002.phpt
+++ b/ext/pdo/tests/pdo_002.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_NUM
+PDO Common: PDO::FETCH_NUM
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,7 +21,7 @@ $db->exec("INSERT INTO test VALUES(3, 'C')");
$stmt = $db->prepare('SELECT * from test');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_NUM));
+var_dump($stmt->fetchAll(PDO::FETCH_NUM));
?>
--EXPECT--
array(3) {
diff --git a/ext/pdo/tests/pdo_003.phpt b/ext/pdo/tests/pdo_003.phpt
index 963b43b942..fb99d2a255 100644
--- a/ext/pdo/tests/pdo_003.phpt
+++ b/ext/pdo/tests/pdo_003.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_BOTH
+PDO Common: PDO::FETCH_BOTH
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,7 +21,7 @@ $db->exec("INSERT INTO test VALUES(3, 'C')");
$stmt = $db->prepare('SELECT * from test');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_BOTH));
+var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
?>
--EXPECT--
array(3) {
diff --git a/ext/pdo/tests/pdo_004.phpt b/ext/pdo/tests/pdo_004.phpt
index 6c8363885c..540faf6ba8 100644
--- a/ext/pdo/tests/pdo_004.phpt
+++ b/ext/pdo/tests/pdo_004.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_OBJ
+PDO Common: PDO::FETCH_OBJ
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,7 +21,7 @@ $db->exec("INSERT INTO test VALUES(3, 'C')");
$stmt = $db->prepare('SELECT * from test');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_OBJ));
+var_dump($stmt->fetchAll(PDO::FETCH_OBJ));
?>
--EXPECTF--
array(3) {
diff --git a/ext/pdo/tests/pdo_005.phpt b/ext/pdo/tests/pdo_005.phpt
index 2b658de8fa..04ffe18604 100644
--- a/ext/pdo/tests/pdo_005.phpt
+++ b/ext/pdo/tests/pdo_005.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_CLASS
+PDO Common: PDO::FETCH_CLASS
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -39,13 +39,13 @@ class TestDerived extends TestBase
}
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_CLASS));
+var_dump($stmt->fetchAll(PDO::FETCH_CLASS));
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_CLASS, 'TestBase'));
+var_dump($stmt->fetchAll(PDO::FETCH_CLASS, 'TestBase'));
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_CLASS, 'TestDerived', array(0)));
+var_dump($stmt->fetchAll(PDO::FETCH_CLASS, 'TestDerived', array(0)));
?>
--EXPECTF--
diff --git a/ext/pdo/tests/pdo_006.phpt b/ext/pdo/tests/pdo_006.phpt
index a07bc856a5..33baac3fc7 100644
--- a/ext/pdo/tests/pdo_006.phpt
+++ b/ext/pdo/tests/pdo_006.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_GROUP
+PDO Common: PDO::FETCH_GROUP
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,10 +21,10 @@ $db->exec("INSERT INTO test VALUES(3, 'C')");
$stmt = $db->prepare('SELECT val, id from test');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_NUM|PDO_FETCH_GROUP));
+var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_GROUP));
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_ASSOC|PDO_FETCH_GROUP));
+var_dump($stmt->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_GROUP));
?>
--EXPECT--
diff --git a/ext/pdo/tests/pdo_007.phpt b/ext/pdo/tests/pdo_007.phpt
index e50846ec9e..657daaa558 100644
--- a/ext/pdo/tests/pdo_007.phpt
+++ b/ext/pdo/tests/pdo_007.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_UNIQUE
+PDO Common: PDO::FETCH_UNIQUE
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,10 +21,10 @@ $db->exec("INSERT INTO test VALUES('C', 'C')");
$stmt = $db->prepare('SELECT id, val from test');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_NUM|PDO_FETCH_UNIQUE));
+var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_UNIQUE));
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_ASSOC|PDO_FETCH_UNIQUE));
+var_dump($stmt->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_UNIQUE));
?>
--EXPECT--
diff --git a/ext/pdo/tests/pdo_008.phpt b/ext/pdo/tests/pdo_008.phpt
index 9b49324a37..543359fc18 100644
--- a/ext/pdo/tests/pdo_008.phpt
+++ b/ext/pdo/tests/pdo_008.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_UNIQUE conflict
+PDO Common: PDO::FETCH_UNIQUE conflict
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,7 +21,7 @@ $db->exec("INSERT INTO test VALUES('C', 'C')");
$stmt = $db->prepare('SELECT val, id from test');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_NUM|PDO_FETCH_UNIQUE));
+var_dump($stmt->fetchAll(PDO::FETCH_NUM|PDO::FETCH_UNIQUE));
?>
--EXPECT--
diff --git a/ext/pdo/tests/pdo_009.phpt b/ext/pdo/tests/pdo_009.phpt
index 61e1987734..a8a31e962e 100644
--- a/ext/pdo/tests/pdo_009.phpt
+++ b/ext/pdo/tests/pdo_009.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_CLASSTYPE
+PDO Common: PDO::FETCH_CLASSTYPE
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -50,10 +50,10 @@ class Test3
}
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_NUM));
+var_dump($stmt->fetchAll(PDO::FETCH_NUM));
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE, 'Test3'));
+var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE, 'Test3'));
?>
--EXPECTF--
diff --git a/ext/pdo/tests/pdo_010.phpt b/ext/pdo/tests/pdo_010.phpt
index d78d1bf7ee..8a34d5791b 100644
--- a/ext/pdo/tests/pdo_010.phpt
+++ b/ext/pdo/tests/pdo_010.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_CLASSTYPE and GROUP/UNIQUE
+PDO Common: PDO::FETCH_CLASSTYPE and GROUP/UNIQUE
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -51,10 +51,10 @@ class Test3
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_GROUP, 'Test3'));
+var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_GROUP, 'Test3'));
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_UNIQUE, 'Test3'));
+var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_UNIQUE, 'Test3'));
?>
--EXPECTF--
diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt
index c2ff2b6e96..08aa55dba8 100644
--- a/ext/pdo/tests/pdo_011.phpt
+++ b/ext/pdo/tests/pdo_011.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_FUNC and statement overloading
+PDO Common: PDO::FETCH_FUNC and statement overloading
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -35,7 +35,7 @@ class DerivedStatement extends PDOStatement
$select1 = $db->prepare('SELECT grp, id FROM test');
$select2 = $db->prepare('SELECT id, val FROM test');
-$derived = $db->prepare('SELECT id, val FROM test', array(PDO_ATTR_STATEMENT_CLASS=>array('DerivedStatement', array('Overloaded', $db))));
+$derived = $db->prepare('SELECT id, val FROM test', array(PDO::ATTR_STATEMENT_CLASS=>array('DerivedStatement', array('Overloaded', $db))));
class Test1
{
@@ -62,20 +62,20 @@ function test($id,$val='N/A')
$f = new Test1(0,0);
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_FUNC|PDO_FETCH_GROUP, 'test'));
+var_dump($select1->fetchAll(PDO::FETCH_FUNC|PDO::FETCH_GROUP, 'test'));
$select2->execute();
-var_dump($select2->fetchAll(PDO_FETCH_FUNC, 'test'));
+var_dump($select2->fetchAll(PDO::FETCH_FUNC, 'test'));
$select2->execute();
-var_dump($select2->fetchAll(PDO_FETCH_FUNC, array('Test1','factory')));
+var_dump($select2->fetchAll(PDO::FETCH_FUNC, array('Test1','factory')));
$select2->execute();
-var_dump($select2->fetchAll(PDO_FETCH_FUNC, array($f, 'factory')));
+var_dump($select2->fetchAll(PDO::FETCH_FUNC, array($f, 'factory')));
var_dump(get_class($derived));
$derived->execute();
-var_dump($derived->fetchAll(PDO_FETCH_FUNC, array($derived, 'retrieve')));
+var_dump($derived->fetchAll(PDO::FETCH_FUNC, array($derived, 'retrieve')));
?>
--EXPECTF--
diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt
index de6857ae15..22db0796e0 100644
--- a/ext/pdo/tests/pdo_012.phpt
+++ b/ext/pdo/tests/pdo_012.phpt
@@ -19,7 +19,7 @@ $db->exec('INSERT INTO test VALUES(2, \'B\', \'Group2\')');
$SELECT = 'SELECT val, grp FROM test';
-$stmt = $db->query($SELECT, PDO_FETCH_NUM);
+$stmt = $db->query($SELECT, PDO::FETCH_NUM);
var_dump($stmt->fetchAll());
class Test
@@ -32,13 +32,13 @@ class Test
unset($stmt);
-$stmt = $db->query($SELECT, PDO_FETCH_CLASS, 'Test');
+$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test');
var_dump($stmt->fetchAll());
unset($stmt);
-$stmt = $db->query($SELECT, PDO_FETCH_NUM);
-$stmt->setFetchMode(PDO_FETCH_CLASS, 'Test', array('Changed'));
+$stmt = $db->query($SELECT, PDO::FETCH_NUM);
+$stmt->setFetchMode(PDO::FETCH_CLASS, 'Test', array('Changed'));
var_dump($stmt->fetchAll());
?>
diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt
index 1a0e601c47..08a62af131 100644
--- a/ext/pdo/tests/pdo_013.phpt
+++ b/ext/pdo/tests/pdo_013.phpt
@@ -22,7 +22,7 @@ $SELECT = 'SELECT val, grp FROM test';
$stmt = $db->prepare($SELECT);
$stmt->execute();
-$stmt->setFetchMode(PDO_FETCH_NUM);
+$stmt->setFetchMode(PDO::FETCH_NUM);
foreach ($stmt as $data)
{
var_dump($data);
@@ -38,14 +38,14 @@ class Test
unset($stmt);
-foreach ($db->query($SELECT, PDO_FETCH_CLASS, 'Test') as $data)
+foreach ($db->query($SELECT, PDO::FETCH_CLASS, 'Test') as $data)
{
var_dump($data);
}
unset($stmt);
-$stmt = $db->query($SELECT, PDO_FETCH_CLASS, 'Test', array('WOW'));
+$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW'));
foreach($stmt as $data)
{
diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt
index 316b8447f2..2343ee48df 100644
--- a/ext/pdo/tests/pdo_014.phpt
+++ b/ext/pdo/tests/pdo_014.phpt
@@ -28,7 +28,7 @@ class Test
}
}
-$stmt = $db->query($SELECT, PDO_FETCH_CLASS, 'Test', array('WOW'));
+$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW'));
$it = new IteratorIterator($stmt); /* check if we can convert that thing */
@@ -48,7 +48,7 @@ class PDOStatementAggregate extends PDOStatement implements IteratorAggregate
private function __construct()
{
echo __METHOD__ . "\n";
- $this->setFetchMode(PDO_FETCH_NUM);
+ $this->setFetchMode(PDO::FETCH_NUM);
/* default fetch mode is BOTH, so we see if the ctor can overwrite that */
}
@@ -60,7 +60,7 @@ class PDOStatementAggregate extends PDOStatement implements IteratorAggregate
}
}
-$stmt = $db->prepare($SELECT, array(PDO_ATTR_STATEMENT_CLASS=>array('PDOStatementAggregate')));
+$stmt = $db->prepare($SELECT, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementAggregate')));
foreach($stmt as $data)
{
diff --git a/ext/pdo/tests/pdo_015.phpt b/ext/pdo/tests/pdo_015.phpt
index 7a00a77acb..cb3addd473 100644
--- a/ext/pdo/tests/pdo_015.phpt
+++ b/ext/pdo/tests/pdo_015.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_COLUMN
+PDO Common: PDO::FETCH_COLUMN
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -21,22 +21,22 @@ $select1 = $db->prepare('SELECT id, val, val2 FROM test');
$select2 = $db->prepare('SELECT val, val2 FROM test');
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_COLUMN));
+var_dump($select1->fetchAll(PDO::FETCH_COLUMN));
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_COLUMN, 2));
+var_dump($select1->fetchAll(PDO::FETCH_COLUMN, 2));
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_GROUP));
+var_dump($select1->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP));
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE));
+var_dump($select1->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE));
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE, 0));
+var_dump($select1->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE, 0));
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE, 1));
+var_dump($select1->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE, 1));
$select1->execute();
-var_dump($select1->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE, 2));
+var_dump($select1->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE, 2));
$select2->execute();
-var_dump($select2->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_GROUP));
+var_dump($select2->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP));
?>
--EXPECT--
diff --git a/ext/pdo/tests/pdo_016.phpt b/ext/pdo/tests/pdo_016.phpt
index 9b7d168420..1e1744ce59 100644
--- a/ext/pdo/tests/pdo_016.phpt
+++ b/ext/pdo/tests/pdo_016.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_BOUND
+PDO Common: PDO::FETCH_BOUND
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -26,7 +26,7 @@ var_dump($stmt1->fetchColumn());
$stmt1 = null;
$stmt2->execute();
-$cont = $stmt2->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE);
+$cont = $stmt2->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE);
var_dump($cont);
echo "===WHILE===\n";
@@ -35,7 +35,7 @@ $stmt2->bindColumn('idx', $idx);
$stmt2->bindColumn('txt', $txt);
$stmt2->execute();
-while($stmt2->fetch(PDO_FETCH_BOUND)) {
+while($stmt2->fetch(PDO::FETCH_BOUND)) {
var_dump(array($idx=>$txt));
}
@@ -57,7 +57,7 @@ foreach($cont as $idx => $txt)
* after execute() has been called at least once */
$stmt3->bindColumn('txt', $col1);
}
- var_dump($stmt3->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
$stmt3->closeCursor();
var_dump($stmt4->execute());
@@ -66,7 +66,7 @@ foreach($cont as $idx => $txt)
* after execute() has been called at least once */
$stmt4->bindColumn('idx', $col2);
}
- var_dump($stmt4->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
$stmt4->closeCursor();
var_dump(array($col2=>$col1));
}
@@ -79,11 +79,11 @@ foreach($cont as $idx => $txt)
{
var_dump(array($idx=>$txt));
var_dump($stmt3->execute());
- var_dump($stmt3->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
$stmt3->closeCursor();
var_dump($col1);
var_dump($stmt4->execute());
- var_dump($stmt4->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
$stmt4->closeCursor();
var_dump($col1);
}
@@ -94,7 +94,7 @@ $stmt2->bindColumn('idx', $col1);
$stmt2->bindColumn('txt', $col1);
$stmt2->execute();
-while($stmt2->fetch(PDO_FETCH_BOUND))
+while($stmt2->fetch(PDO::FETCH_BOUND))
{
var_dump($col1);
}
diff --git a/ext/pdo/tests/pdo_016a.phpt b/ext/pdo/tests/pdo_016a.phpt
index 0303ea8ce7..699ddea7f8 100755
--- a/ext/pdo/tests/pdo_016a.phpt
+++ b/ext/pdo/tests/pdo_016a.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_BOUND w/o :
+PDO Common: PDO::FETCH_BOUND w/o :
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -26,7 +26,7 @@ var_dump($stmt1->fetchColumn());
$stmt1 = null;
$stmt2->execute();
-$cont = $stmt2->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE);
+$cont = $stmt2->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE);
var_dump($cont);
echo "===WHILE===\n";
@@ -35,7 +35,7 @@ $stmt2->bindColumn('idx', $idx);
$stmt2->bindColumn('txt', $txt);
$stmt2->execute();
-while($stmt2->fetch(PDO_FETCH_BOUND)) {
+while($stmt2->fetch(PDO::FETCH_BOUND)) {
var_dump(array($idx=>$txt));
}
@@ -57,7 +57,7 @@ foreach($cont as $idx => $txt)
* after execute() has been called at least once */
$stmt3->bindColumn('txt', $col1);
}
- var_dump($stmt3->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
$stmt3->closeCursor();
var_dump($stmt4->execute());
@@ -66,7 +66,7 @@ foreach($cont as $idx => $txt)
* after execute() has been called at least once */
$stmt4->bindColumn('idx', $col2);
}
- var_dump($stmt4->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
$stmt4->closeCursor();
var_dump(array($col2=>$col1));
}
@@ -79,11 +79,11 @@ foreach($cont as $idx => $txt)
{
var_dump(array($idx=>$txt));
var_dump($stmt3->execute());
- var_dump($stmt3->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
$stmt3->closeCursor();
var_dump($col1);
var_dump($stmt4->execute());
- var_dump($stmt4->fetch(PDO_FETCH_BOUND));
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
$stmt4->closeCursor();
var_dump($col1);
}
@@ -94,7 +94,7 @@ $stmt2->bindColumn('idx', $col1);
$stmt2->bindColumn('txt', $col1);
$stmt2->execute();
-while($stmt2->fetch(PDO_FETCH_BOUND))
+while($stmt2->fetch(PDO::FETCH_BOUND))
{
var_dump($col1);
}
diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt
index def132e569..bb35bd8aca 100644
--- a/ext/pdo/tests/pdo_017.phpt
+++ b/ext/pdo/tests/pdo_017.phpt
@@ -15,7 +15,7 @@ try {
die('skip no working transactions: ' . $e->getMessage());
}
-if ($db->getAttribute(PDO_ATTR_DRIVER_NAME) == 'mysql') {
+if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
if (false === PDOTest::detect_transactional_mysql_engine($db)) {
die('skip your mysql configuration does not support working transactions');
}
@@ -26,7 +26,7 @@ if ($db->getAttribute(PDO_ATTR_DRIVER_NAME) == 'mysql') {
require getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
-if ($db->getAttribute(PDO_ATTR_DRIVER_NAME) == 'mysql') {
+if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
$suf = ' Type=' . PDOTest::detect_transactional_mysql_engine($db);
} else {
$suf = '';
diff --git a/ext/pdo/tests/pdo_018.phpt b/ext/pdo/tests/pdo_018.phpt
index ad6cea8cd8..b3cb378110 100644
--- a/ext/pdo/tests/pdo_018.phpt
+++ b/ext/pdo/tests/pdo_018.phpt
@@ -72,10 +72,10 @@ $db->exec('INSERT INTO classtypes VALUES(1, \'TestBase\')');
$db->exec('INSERT INTO classtypes VALUES(2, \'TestDerived\')');
$db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, classtype int NULL, val VARCHAR(255))');
-$db->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION);
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
var_dump($db->query('SELECT COUNT(*) FROM classtypes')->fetchColumn());
-var_dump($db->query('SELECT id, name FROM classtypes ORDER by id')->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE));
+var_dump($db->query('SELECT id, name FROM classtypes ORDER by id')->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE));
$objs = array();
$objs[0] = new stdClass;
@@ -94,7 +94,7 @@ foreach($objs as $obj)
$ctype = NULL; /* set default for non stored class name */
$stmt->execute();
$stmt->bindColumn('id', $ctype);
- $stmt->fetch(PDO_FETCH_BOUND);
+ $stmt->fetch(PDO::FETCH_BOUND);
$ctypes[$cname] = $ctype;
}
@@ -126,12 +126,12 @@ foreach($objs as $idx => $obj)
unset($stmt);
echo "===DATA===\n";
-var_dump($db->query('SELECT test.val FROM test')->fetchAll(PDO_FETCH_COLUMN));
+var_dump($db->query('SELECT test.val FROM test')->fetchAll(PDO::FETCH_COLUMN));
echo "===FAILURE===\n";
try
{
- $db->query('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_SERIALIZE, 'TestLeaf', array());
+ $db->query('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array());
}
catch (PDOException $e)
{
@@ -146,11 +146,11 @@ echo "===DATABASE===\n";
$stmt = $db->prepare('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)');
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_ASSOC));
+var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
echo "===FETCHCLASS===\n";
$stmt->execute();
-var_dump($stmt->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_SERIALIZE, 'TestLeaf'));
+var_dump($stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf'));
?>
diff --git a/ext/pdo/tests/pdo_019.phpt b/ext/pdo/tests/pdo_019.phpt
index 3a4652a3e7..35a20f07ae 100644
--- a/ext/pdo/tests/pdo_019.phpt
+++ b/ext/pdo/tests/pdo_019.phpt
@@ -25,7 +25,7 @@ var_dump($db->query('SELECT COUNT(*) FROM test')->fetchColumn());
$stmt = $db->prepare('SELECT idx, txt FROM test ORDER by idx');
$stmt->execute();
-$cont = $stmt->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE);
+$cont = $stmt->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE);
var_dump($cont);
echo "===WHILE===\n";
@@ -34,7 +34,7 @@ $stmt->bindColumn('idx', $idx);
$stmt->bindColumn('txt', $txt);
$stmt->execute();
-while($stmt->fetch(PDO_FETCH_BOUND)) {
+while($stmt->fetch(PDO::FETCH_BOUND)) {
var_dump(array($idx=>$txt));
}
diff --git a/ext/pdo/tests/pdo_023.phpt b/ext/pdo/tests/pdo_023.phpt
index 109781e23a..c2108ed3a4 100644
--- a/ext/pdo/tests/pdo_023.phpt
+++ b/ext/pdo/tests/pdo_023.phpt
@@ -49,7 +49,7 @@ class PDODatabaseX extends PDO
function query($sql)
{
echo __METHOD__ . "()\n";
- $stmt = parent::prepare($sql, array(PDO_ATTR_STATEMENT_CLASS=>array('PDOStatementx')));
+ $stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx')));
$stmt->execute();
return $stmt;
}
@@ -66,7 +66,7 @@ $db->query('INSERT INTO test VALUES(1, \'B\')');
$stmt = $db->query('SELECT val, id FROM test');
var_dump($stmt);
-var_dump($stmt->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE));
+var_dump($stmt->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_UNIQUE));
$stmt = NULL;
$db = NULL;
diff --git a/ext/pdo/tests/pdo_025.phpt b/ext/pdo/tests/pdo_025.phpt
index b97db84991..8a0d72a5b1 100644
--- a/ext/pdo/tests/pdo_025.phpt
+++ b/ext/pdo/tests/pdo_025.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_INTO
+PDO Common: PDO::FETCH_INTO
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -36,7 +36,7 @@ class Test {
}
$stmt = $db->prepare('SELECT * FROM test');
-$stmt->setFetchMode(PDO_FETCH_INTO, new Test);
+$stmt->setFetchMode(PDO::FETCH_INTO, new Test);
$stmt->execute();
foreach($stmt as $obj) {
@@ -50,7 +50,7 @@ class Fail {
public $val, $val2;
}
-$stmt->setFetchMode(PDO_FETCH_INTO, new Fail);
+$stmt->setFetchMode(PDO::FETCH_INTO, new Fail);
$stmt->execute();
foreach($stmt as $obj) {
diff --git a/ext/pdo/tests/pdo_026.phpt b/ext/pdo/tests/pdo_026.phpt
index e0a4a7ea55..aa07034c72 100644
--- a/ext/pdo/tests/pdo_026.phpt
+++ b/ext/pdo/tests/pdo_026.phpt
@@ -44,8 +44,8 @@ class PDODatabase extends PDO
function query($sql)
{
echo __METHOD__ . "()\n";
- $stmt = $this->prepare($sql, array(PDO_ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
- $stmt->setFetchMode(PDO_FETCH_ASSOC);
+ $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
+ $stmt->setFetchMode(PDO::FETCH_ASSOC);
$stmt->execute();
return $stmt;
}
diff --git a/ext/pdo/tests/pdo_027.phpt b/ext/pdo/tests/pdo_027.phpt
index 468aeedc62..226b4670aa 100644
--- a/ext/pdo/tests/pdo_027.phpt
+++ b/ext/pdo/tests/pdo_027.phpt
@@ -1,5 +1,5 @@
--TEST--
-PDO Common: PDO_FETCH_LAZY
+PDO Common: PDO::FETCH_LAZY
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
@@ -17,7 +17,7 @@ $db->exec('create table test (id int, name varchar(10) NULL)');
$db->exec("INSERT INTO test (id,name) VALUES(1,'test1')");
$db->exec("INSERT INTO test (id,name) VALUES(2,'test2')");
-foreach ($db->query("SELECT * FROM test", PDO_FETCH_LAZY) as $v) {
+foreach ($db->query("SELECT * FROM test", PDO::FETCH_LAZY) as $v) {
echo "lazy: " . $v->id.$v->name."\n";
}
echo "End\n";
diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc
index 2498d43f58..79df2baa29 100644
--- a/ext/pdo/tests/pdo_test.inc
+++ b/ext/pdo/tests/pdo_test.inc
@@ -30,9 +30,9 @@ class PDOTest {
$db->exec("DROP TABLE $table");
}
- $db->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_WARNING);
- $db->setAttribute(PDO_ATTR_CASE, PDO_CASE_LOWER);
- $db->setAttribute(PDO_ATTR_STRINGIFY_FETCHES, true);
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
return $db;
}
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index a224e6e012..3f92c8dcb3 100755
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -75,7 +75,7 @@ ZEND_GET_MODULE(pdo_mysql)
*/
PHP_MINIT_FUNCTION(pdo_mysql)
{
- REGISTER_LONG_CONSTANT("PDO_MYSQL_ATTR_USE_BUFFERED_QUERY", (long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_PDO_CONST_LONG("PDO_MYSQL_ATTR_USE_BUFFERED_QUERY", (long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY);
return php_pdo_register_driver(&pdo_mysql_driver);
}
diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c
index 72cb4e7241..2161296b03 100644
--- a/ext/pdo_pgsql/pdo_pgsql.c
+++ b/ext/pdo_pgsql/pdo_pgsql.c
@@ -77,7 +77,7 @@ ZEND_GET_MODULE(pdo_pgsql)
PHP_MINIT_FUNCTION(pdo_pgsql)
{
php_pdo_register_driver(&pdo_pgsql_driver);
- REGISTER_LONG_CONSTANT("PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, CONST_CS|CONST_PERSISTENT);
+ REGISTER_PDO_CONST_LONG("PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT", PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT);
return SUCCESS;
}
/* }}} */
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index 88e0e4620f..e5889ef4d7 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -506,7 +506,9 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return
static int pdo_pgsql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
{
+#if HAVE_PQPREPARE
return 1;
+#endif
}
struct pdo_stmt_methods pgsql_stmt_methods = {