Skip to content

Commit 2d52c13

Browse files
committed
DB Drivers
1 parent a1a51a4 commit 2d52c13

14 files changed

+73
-73
lines changed

ext/pdo_dblib/dblib_driver.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
539539
}
540540
}
541541

542-
#if !PHP_DBLIB_IS_MSSQL
542+
#ifndef PHP_DBLIB_IS_MSSQL
543543
if (vars[0].optval) {
544544
DBSETLCHARSET(H->login, vars[0].optval);
545545
}
@@ -570,7 +570,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
570570
}
571571
#endif
572572

573-
#if PHP_DBLIB_IS_MSSQL
573+
#ifdef PHP_DBLIB_IS_MSSQL
574574
/* dblib do not return more than this length from text/image */
575575
DBSETOPT(H->link, DBTEXTLIMIT, "2147483647");
576576
#endif
@@ -607,7 +607,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
607607
}
608608

609609
const pdo_driver_t pdo_dblib_driver = {
610-
#if PDO_DBLIB_IS_MSSQL
610+
#ifdef PDO_DBLIB_IS_MSSQL
611611
PDO_DRIVER_HEADER(mssql),
612612
#elif defined(PHP_WIN32)
613613
#define PDO_DBLIB_IS_SYBASE

ext/pdo_dblib/pdo_dblib.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ static const zend_module_dep pdo_dblib_deps[] = {
4040
ZEND_MOD_END
4141
};
4242

43-
#if PDO_DBLIB_IS_MSSQL
43+
#ifdef PDO_DBLIB_IS_MSSQL
4444
zend_module_entry pdo_mssql_module_entry = {
4545
#else
4646
zend_module_entry pdo_dblib_module_entry = {
4747
#endif
4848
STANDARD_MODULE_HEADER_EX, NULL,
4949
pdo_dblib_deps,
50-
#if PDO_DBLIB_IS_MSSQL
50+
#ifdef PDO_DBLIB_IS_MSSQL
5151
"pdo_mssql",
5252
#elif defined(PHP_WIN32)
5353
"pdo_sybase",
@@ -72,7 +72,7 @@ zend_module_entry pdo_dblib_module_entry = {
7272
#ifdef ZTS
7373
ZEND_TSRMLS_CACHE_DEFINE()
7474
#endif
75-
#if PDO_DBLIB_IS_MSSQL
75+
#ifdef PDO_DBLIB_IS_MSSQL
7676
ZEND_GET_MODULE(pdo_mssql)
7777
#else
7878
ZEND_GET_MODULE(pdo_dblib)
@@ -209,7 +209,7 @@ PHP_MINIT_FUNCTION(pdo_dblib)
209209
return FAILURE;
210210
}
211211

212-
#if !PHP_DBLIB_IS_MSSQL
212+
#ifndef PHP_DBLIB_IS_MSSQL
213213
dberrhandle((EHANDLEFUNC) pdo_dblib_error_handler);
214214
dbmsghandle((MHANDLEFUNC) pdo_dblib_msg_handler);
215215
#endif
@@ -228,7 +228,7 @@ PHP_MINFO_FUNCTION(pdo_dblib)
228228
{
229229
php_info_print_table_start();
230230
php_info_print_table_header(2, "PDO Driver for "
231-
#if PDO_DBLIB_IS_MSSQL
231+
#ifdef PDO_DBLIB_IS_MSSQL
232232
"MSSQL"
233233
#elif defined(PHP_WIN32)
234234
"FreeTDS/Sybase/MSSQL"

ext/pdo_dblib/php_pdo_dblib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef PHP_PDO_DBLIB_H
1919
#define PHP_PDO_DBLIB_H
2020

21-
#if PDO_DBLIB_IS_MSSQL
21+
#ifdef PDO_DBLIB_IS_MSSQL
2222
extern zend_module_entry pdo_mssql_module_entry;
2323
#define phpext_pdo_mssql_ptr &pdo_mssql_module_entry
2424
#else

ext/pdo_dblib/php_pdo_dblib_int.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# define PDO_DBLIB_FLAVOUR "Generic DB-lib"
2323
#endif
2424

25-
#if PHP_DBLIB_IS_MSSQL
25+
#ifdef PHP_DBLIB_IS_MSSQL
2626
# include <sqlfront.h>
2727
# include <sqldb.h>
2828

ext/pdo_mysql/mysql_driver.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#endif
3333
#include "zend_exceptions.h"
3434

35-
#if defined(PDO_USE_MYSQLND)
35+
#ifdef PDO_USE_MYSQLND
3636
# define pdo_mysql_init(persistent) mysqlnd_init(MYSQLND_CLIENT_NO_FLAG, persistent)
3737
#else
3838
# define pdo_mysql_init(persistent) mysql_init(NULL)
@@ -224,7 +224,7 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len
224224

225225
if (S->num_params) {
226226
S->params_given = 0;
227-
#if defined(PDO_USE_MYSQLND)
227+
#ifdef PDO_USE_MYSQLND
228228
S->params = NULL;
229229
#else
230230
S->params = ecalloc(S->num_params, sizeof(MYSQL_BIND));
@@ -444,7 +444,7 @@ static int pdo_mysql_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_
444444
ZVAL_STRING(return_value, (char *)mysql_get_host_info(H->server));
445445
break;
446446
case PDO_ATTR_SERVER_INFO: {
447-
#if defined(PDO_USE_MYSQLND)
447+
#ifdef PDO_USE_MYSQLND
448448
zend_string *tmp;
449449

450450
if (mysqlnd_stat(H->server, &tmp) == PASS) {
@@ -577,7 +577,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
577577
|CLIENT_MULTI_RESULTS
578578
#endif
579579
;
580-
#if defined(PDO_USE_MYSQLND)
580+
#ifdef PDO_USE_MYSQLND
581581
size_t dbname_len = 0;
582582
size_t password_len = 0;
583583
#endif
@@ -610,7 +610,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
610610
pdo_mysql_error(dbh);
611611
goto cleanup;
612612
}
613-
#if defined(PDO_USE_MYSQLND)
613+
#ifdef PDO_USE_MYSQLND
614614
if (dbh->is_persistent) {
615615
mysqlnd_restart_psession(H->server);
616616
}

ext/pdo_mysql/mysql_statement.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */
100100
}
101101
}
102102

103-
#if PDO_USE_MYSQLND
103+
#ifdef PDO_USE_MYSQLND
104104
if (!S->stmt && S->current_data) {
105105
mnd_free(S->current_data);
106106
}
@@ -339,13 +339,13 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
339339
{
340340
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
341341
pdo_mysql_db_handle *H = S->H;
342-
#if PDO_USE_MYSQLND
342+
#ifdef PDO_USE_MYSQLND
343343
zend_long row_count;
344344
#endif
345345
PDO_DBG_ENTER("pdo_mysql_stmt_next_rowset");
346346
PDO_DBG_INF_FMT("stmt=%p", S->stmt);
347347

348-
#if PDO_USE_MYSQLND
348+
#ifdef PDO_USE_MYSQLND
349349
if (!H->emulate_prepare) {
350350
if (!mysqlnd_stmt_more_results(S->stmt)) {
351351
PDO_DBG_RETURN(0);
@@ -416,7 +416,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
416416
/* No more results */
417417
PDO_DBG_RETURN(0);
418418
}
419-
#if PDO_USE_MYSQLND
419+
#ifdef PDO_USE_MYSQLND
420420
if (mysql_next_result(H->server) == FAIL) {
421421
pdo_mysql_error_stmt(stmt);
422422
PDO_DBG_RETURN(0);
@@ -491,7 +491,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
491491
parameter = Z_REFVAL(param->parameter);
492492
}
493493

494-
#if PDO_USE_MYSQLND
494+
#ifdef PDO_USE_MYSQLND
495495
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_NULL || (Z_TYPE_P(parameter) == IS_NULL)) {
496496
mysqlnd_stmt_bind_one_param(S->stmt, param->paramno, parameter, MYSQL_TYPE_NULL);
497497
PDO_DBG_RETURN(1);
@@ -537,7 +537,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
537537
;
538538
}
539539

540-
#if PDO_USE_MYSQLND
540+
#ifdef PDO_USE_MYSQLND
541541
/* Is it really correct to check the zval's type? - But well, that's what the old code below does, too */
542542
PDO_DBG_INF_FMT("param->parameter->type=%d", Z_TYPE(param->parameter));
543543
if (!Z_ISREF(param->parameter)) {
@@ -614,7 +614,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
614614
static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset) /* {{{ */
615615
{
616616
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
617-
#if PDO_USE_MYSQLND
617+
#ifdef PDO_USE_MYSQLND
618618
zend_bool fetched_anything;
619619

620620
PDO_DBG_ENTER("pdo_mysql_stmt_fetch");
@@ -653,14 +653,14 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori
653653
strcpy(stmt->error_code, "HY000");
654654
PDO_DBG_RETURN(0);
655655
}
656-
#if PDO_USE_MYSQLND
656+
#ifdef PDO_USE_MYSQLND
657657
if (!S->stmt && S->current_data) {
658658
mnd_free(S->current_data);
659659
}
660660
#endif /* PDO_USE_MYSQLND */
661661

662662
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
663-
#if PDO_USE_MYSQLND
663+
#ifdef PDO_USE_MYSQLND
664664
if (S->result->unbuf && !S->result->unbuf->eof_reached && mysql_errno(S->H->server)) {
665665
#else
666666
if (!S->result->eof && mysql_errno(S->H->server)) {
@@ -743,7 +743,7 @@ static int pdo_mysql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, size_
743743
/* error invalid column */
744744
PDO_DBG_RETURN(0);
745745
}
746-
#if PDO_USE_MYSQLND
746+
#ifdef PDO_USE_MYSQLND
747747
if (S->stmt) {
748748
Z_TRY_ADDREF(S->stmt->data->result_bind[colno].zv);
749749
*ptr = (char*)&S->stmt->data->result_bind[colno].zv;

ext/pdo_mysql/pdo_mysql.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static PHP_MINFO_FUNCTION(pdo_mysql)
169169
/* }}} */
170170

171171

172-
#if defined(PDO_USE_MYSQLND) && PDO_USE_MYSQLND && PDO_DBG_ENABLED
172+
#if defined(PDO_USE_MYSQLND) && PDO_DBG_ENABLED
173173
/* {{{ PHP_RINIT_FUNCTION
174174
*/
175175
static PHP_RINIT_FUNCTION(pdo_mysql)
@@ -245,7 +245,7 @@ zend_module_entry pdo_mysql_module_entry = {
245245
pdo_mysql_functions,
246246
PHP_MINIT(pdo_mysql),
247247
PHP_MSHUTDOWN(pdo_mysql),
248-
#if defined(PDO_USE_MYSQLND) && defined(PDO_DBG_ENABLED) && PDO_USE_MYSQLND && PDO_DBG_ENABLED
248+
#if defined(PDO_USE_MYSQLND) && PDO_DBG_ENABLED
249249
PHP_RINIT(pdo_mysql),
250250
PHP_RSHUTDOWN(pdo_mysql),
251251
#else

ext/pdo_mysql/php_pdo_mysql_int.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef PHP_PDO_MYSQL_INT_H
2020
#define PHP_PDO_MYSQL_INT_H
2121

22-
#if defined(PDO_USE_MYSQLND)
22+
#ifdef PDO_USE_MYSQLND
2323
# include "ext/mysqlnd/mysqlnd.h"
2424
# include "ext/mysqlnd/mysqlnd_libmysql_compat.h"
2525
# define PDO_MYSQL_PARAM_BIND MYSQLND_PARAM_BIND
@@ -57,7 +57,7 @@ static inline void PDO_DBG_ENTER(char *func_name) {}
5757

5858
#endif
5959

60-
#if defined(PDO_USE_MYSQLND)
60+
#ifdef PDO_USE_MYSQLND
6161
#include "ext/mysqlnd/mysqlnd_debug.h"
6262
#endif
6363

@@ -101,7 +101,7 @@ typedef struct {
101101
unsigned buffered:1;
102102
unsigned emulate_prepare:1;
103103
unsigned fetch_table_names:1;
104-
#if !PDO_USE_MYSQLND
104+
#ifndef PDO_USE_MYSQLND
105105
zend_ulong max_buffer_size;
106106
#endif
107107

@@ -117,13 +117,13 @@ typedef struct {
117117
MYSQL_RES *result;
118118
const MYSQL_FIELD *fields;
119119
MYSQL_ROW current_data;
120-
#if PDO_USE_MYSQLND
120+
#ifdef PDO_USE_MYSQLND
121121
const size_t *current_lengths;
122122
#else
123123
zend_long *current_lengths;
124124
#endif
125125
pdo_mysql_error_info einfo;
126-
#if PDO_USE_MYSQLND
126+
#ifdef PDO_USE_MYSQLND
127127
MYSQLND_STMT *stmt;
128128
#else
129129
MYSQL_STMT *stmt;

ext/pdo_oci/oci_driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static int oci_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len,
247247
size_t nsql_len = 0;
248248
int ret;
249249

250-
#if HAVE_OCISTMTFETCH2
250+
#ifdef HAVE_OCISTMTFETCH2
251251
S->exec_type = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR,
252252
PDO_CURSOR_FWDONLY) == PDO_CURSOR_SCROLL ?
253253
OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT;
@@ -727,7 +727,7 @@ static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ *
727727
H->prefetch = PDO_OCI_PREFETCH_DEFAULT;
728728

729729
/* allocate an environment */
730-
#if HAVE_OCIENVNLSCREATE
730+
#ifdef HAVE_OCIENVNLSCREATE
731731
if (vars[0].optval) {
732732
H->charset = OCINlsCharSetNameToId(pdo_oci_Env, (const oratext *)vars[0].optval);
733733
if (!H->charset) {

ext/pdo_oci/oci_statement.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,12 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
458458

459459
static int oci_stmt_fetch(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset) /* {{{ */
460460
{
461-
#if HAVE_OCISTMTFETCH2
461+
#ifdef HAVE_OCISTMTFETCH2
462462
ub4 ociori;
463463
#endif
464464
pdo_oci_stmt *S = (pdo_oci_stmt*)stmt->driver_data;
465465

466-
#if HAVE_OCISTMTFETCH2
466+
#ifdef HAVE_OCISTMTFETCH2
467467
switch (ori) {
468468
case PDO_FETCH_ORI_NEXT: ociori = OCI_FETCH_NEXT; break;
469469
case PDO_FETCH_ORI_PRIOR: ociori = OCI_FETCH_PRIOR; break;

ext/pdo_oci/pdo_oci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ PHP_RINIT_FUNCTION(pdo_oci)
116116
tsrm_mutex_lock(pdo_oci_env_mutex);
117117
if (!pdo_oci_Env) { // double-checked locking idiom
118118
#endif
119-
#if HAVE_OCIENVCREATE
119+
#ifdef HAVE_OCIENVCREATE
120120
OCIEnvCreate(&pdo_oci_Env, PDO_OCI_INIT_MODE, NULL, NULL, NULL, NULL, 0, NULL);
121121
#else
122122
OCIInitialize(PDO_OCI_INIT_MODE, NULL, NULL, NULL, NULL);

0 commit comments

Comments
 (0)