From 2f099739682d57e7cddd17862292c72fdd355b6b Mon Sep 17 00:00:00 2001 From: Adam Baratz Date: Wed, 1 Mar 2017 16:28:47 -0500 Subject: [PATCH] Remove dead code related to error constants --- ext/pdo/pdo_dbh.c | 14 --------- ext/pdo_firebird/firebird_driver.c | 47 ------------------------------ ext/pdo_oci/oci_driver.c | 6 ---- 3 files changed, 67 deletions(-) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 056d6276197..586797e744b 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1488,20 +1488,6 @@ void pdo_dbh_init(void) REGISTER_PDO_CLASS_CONST_LONG("CURSOR_FWDONLY", (zend_long)PDO_CURSOR_FWDONLY); REGISTER_PDO_CLASS_CONST_LONG("CURSOR_SCROLL", (zend_long)PDO_CURSOR_SCROLL); - -#if 0 - REGISTER_PDO_CLASS_CONST_LONG("ERR_CANT_MAP", (zend_long)PDO_ERR_CANT_MAP); - REGISTER_PDO_CLASS_CONST_LONG("ERR_SYNTAX", (zend_long)PDO_ERR_SYNTAX); - REGISTER_PDO_CLASS_CONST_LONG("ERR_CONSTRAINT", (zend_long)PDO_ERR_CONSTRAINT); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_FOUND", (zend_long)PDO_ERR_NOT_FOUND); - REGISTER_PDO_CLASS_CONST_LONG("ERR_ALREADY_EXISTS", (zend_long)PDO_ERR_ALREADY_EXISTS); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NOT_IMPLEMENTED", (zend_long)PDO_ERR_NOT_IMPLEMENTED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_MISMATCH", (zend_long)PDO_ERR_MISMATCH); - REGISTER_PDO_CLASS_CONST_LONG("ERR_TRUNCATED", (zend_long)PDO_ERR_TRUNCATED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_DISCONNECTED", (zend_long)PDO_ERR_DISCONNECTED); - REGISTER_PDO_CLASS_CONST_LONG("ERR_NO_PERM", (zend_long)PDO_ERR_NO_PERM); -#endif - } static void dbh_free(pdo_dbh_t *dbh, zend_bool free_persistent) diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 166fb13d435..ab2571df3d5 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -37,56 +37,9 @@ static int firebird_alloc_prepare_stmt(pdo_dbh_t*, const char*, size_t, XSQLDA*, /* map driver specific error message to PDO error */ void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line) /* {{{ */ { -#if 0 - pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H - : (pdo_firebird_db_handle *)dbh->driver_data; -#endif pdo_error_type *const error_code = stmt ? &stmt->error_code : &dbh->error_code; -#if 0 - switch (isc_sqlcode(H->isc_status)) { - - case 0: - *error_code = PDO_ERR_NONE; - break; - default: - *error_code = PDO_ERR_CANT_MAP; - break; - case -104: - *error_code = PDO_ERR_SYNTAX; - break; - case -530: - case -803: - *error_code = PDO_ERR_CONSTRAINT; - break; - case -204: - case -205: - case -206: - case -829: - *error_code = PDO_ERR_NOT_FOUND; - break; - - *error_code = PDO_ERR_ALREADY_EXISTS; - break; - - *error_code = PDO_ERR_NOT_IMPLEMENTED; - break; - case -313: - case -804: - *error_code = PDO_ERR_MISMATCH; - break; - case -303: - case -314: - case -413: - *error_code = PDO_ERR_TRUNCATED; - break; - - *error_code = PDO_ERR_DISCONNECTED; - break; - } -#else strcpy(*error_code, "HY000"); -#endif } /* }}} */ diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 367f478e124..ac52d10b992 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -132,12 +132,6 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor zend_bailout(); break; -#if 0 - case 955: /* ORA-00955: name is already used by an existing object */ - *pdo_err = PDO_ERR_ALREADY_EXISTS; - break; -#endif - case 12154: /* ORA-12154: TNS:could not resolve service name */ strcpy(*pdo_err, "42S02"); break;