# define pdo_mysql_init(persistent) mysql_init(NULL)
#endif
-#if !HAVE_MYSQL_SQLSTATE && !PDO_USE_MYSQLND
+#if !defined(HAVE_MYSQL_SQLSTATE) && !defined(PDO_USE_MYSQLND)
static const char *pdo_mysql_get_sqlstate(unsigned int my_errno) { /* {{{ */
switch (my_errno) {
/* import auto-generated case: code */
einfo = &H->einfo;
}
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
+#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
if (S && S->stmt) {
einfo->errcode = mysql_stmt_errno(S->stmt);
}
PDO_DBG_RETURN(0);
}
-#if HAVE_MYSQL_SQLSTATE || PDO_USE_MYSQLND
-# if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
+#if defined(HAVE_MYSQL_SQLSTATE) || defined(PDO_USE_MYSQLND)
+# if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
if (S && S->stmt) {
strcpy(*pdo_err, mysql_stmt_sqlstate(S->stmt));
} else
{
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
pdo_mysql_stmt *S = ecalloc(1, sizeof(pdo_mysql_stmt));
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
+#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
char *nsql = NULL;
int nsql_len = 0;
int ret;
goto end;
}
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSQLND
+#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSQLND)
server_version = mysql_get_server_version(H->server);
if (server_version < 40100) {
goto fallback;
if (S->num_params) {
S->params_given = 0;
-#if PDO_USE_MYSQLND
+#ifdef PDO_USE_MYSQLND
S->params = NULL;
#else
S->params = ecalloc(S->num_params, sizeof(MYSQL_BIND));
PDO_DBG_RETURN(H->einfo.errcode ? -1 : 0);
} else {
-#if HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND
+#if defined(HAVE_MYSQL_NEXT_RESULT) || defined(PDO_USE_MYSQLND)
/* MULTI_QUERY support - eat up all unfetched result sets */
MYSQL_RES* result;
while (mysql_more_results(H->server)) {
break;
case PDO_ATTR_SERVER_INFO: {
char *tmp;
-#if PDO_USE_MYSQLND
+#ifdef PDO_USE_MYSQLND
unsigned int tmp_len;
if (mysqlnd_stat(H->server, &tmp, &tmp_len) == PASS) {
#endif
;
-#if PDO_USE_MYSQLND
+#ifdef PDO_USE_MYSQLND
int dbname_len = 0;
int password_len = 0;
#endif
char *default_file = NULL, *default_group = NULL;
long compress = 0;
#endif
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSLQND
+#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSLQND)
char *ssl_key = NULL, *ssl_cert = NULL, *ssl_ca = NULL, *ssl_capath = NULL, *ssl_cipher = NULL;
#endif
H->buffered = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_USE_BUFFERED_QUERY, 1 TSRMLS_CC);
{
local_infile = 0;
}
-#ifdef MYSQL_OPT_LOCAL_INFILE
+#if defined(MYSQL_OPT_LOCAL_INFILE) || defined(PDO_USE_MYSQLND)
if (mysql_options(H->server, MYSQL_OPT_LOCAL_INFILE, (const char *)&local_infile)) {
pdo_mysql_error(dbh);
goto cleanup;
#endif
#ifdef MYSQL_OPT_RECONNECT
/* since 5.0.3, the default for this option is 0 if not specified.
- * we want the old behaviour */
+ * we want the old behaviour
+ * mysqlnd doesn't support reconnect, thus we don't have "|| defined(PDO_USE_MYSQLND)"
+ */
{
long reconnect = 1;
mysql_options(H->server, MYSQL_OPT_RECONNECT, (const char*)&reconnect);
}
}
#endif
-#if HAVE_MYSQL_STMT_PREPARE || PDO_USE_MYSLQND
+#if defined(HAVE_MYSQL_STMT_PREPARE) || defined(PDO_USE_MYSLQND)
ssl_key = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SSL_KEY, NULL TSRMLS_CC);
ssl_cert = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SSL_CERT, NULL TSRMLS_CC);
ssl_ca = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_SSL_CA, NULL TSRMLS_CC);