]> granicus.if.org Git - php/commitdiff
added check in config.m4 for deprecated library
authorGeorg Richter <georg@php.net>
Wed, 7 Jul 2004 08:02:27 +0000 (08:02 +0000)
committerGeorg Richter <georg@php.net>
Wed, 7 Jul 2004 08:02:27 +0000 (08:02 +0000)
added support for new 4.1.3-beta functions
mysqli_stmt_field_count
mysqli_stmt_attr_set
mysqli_stmt_attr_get
removed support for deprecated/old api functions
fixed bug in constructor_get

ext/mysqli/config.m4
ext/mysqli/mysqli.c
ext/mysqli/mysqli_api.c
ext/mysqli/mysqli_fe.c
ext/mysqli/mysqli_prop.c
ext/mysqli/mysqli_report.c
ext/mysqli/php_mysqli.h

index 215a7aab80b654f7b9321812bd87b31a1c35cb8c..7f00915d0036b4abaf2b8eef35ed744e86288a2d 100644 (file)
@@ -44,10 +44,10 @@ if test "$PHP_MYSQLI" != "no"; then
     PHP_EVAL_INCLINE($MYSQLI_INCLINE)
     PHP_EVAL_LIBLINE($MYSQLI_LIBLINE, MYSQLI_SHARED_LIBADD)
     AC_DEFINE(HAVE_MYSQLILIB,1,[ ])
-    PHP_CHECK_LIBRARY(mysqlclient, mysql_bind_param,
-    [
-       AC_DEFINE(HAVE_MYSQLI_OLDAPI,1,[ ])
-    ],[],[])
+    PHP_CHECK_LIBRARY(mysqlclient, mysql_stmt_field_count,
+    [ ],[
+               AC_MSG_ERROR([MySQLI doesn't support versions < 4.1.3 anymore. Please update your libraries.])
+       ],[])
   ],[
     AC_MSG_ERROR([wrong mysql library version or lib not found. Check config.log for more information.])
   ],[
index 9f248ceb672fc95a39c3f6d56fe8c4f80228013a..684e622ae8c111b17b57a58011e6687f88e8a6fc 100644 (file)
@@ -273,7 +273,7 @@ static union _zend_function *php_mysqli_constructor_get(zval *object TSRMLS_DC)
 {
        mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC);
 
-       if (obj->zo.ce != mysqli_link_class_entry) {
+       if (obj->zo.ce != mysqli_link_class_entry && obj->zo.ce->constructor) {
                return obj->zo.ce->constructor;
        } else {
                static zend_internal_function f;
@@ -441,6 +441,8 @@ PHP_MINIT_FUNCTION(mysqli)
        REGISTER_LONG_CONSTANT("MYSQLI_NUM", MYSQLI_NUM, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("MYSQLI_BOTH", MYSQLI_BOTH, CONST_CS | CONST_PERSISTENT);
        
+       /* for mysqli_stmt_set_attr */
+       REGISTER_LONG_CONSTANT("MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH", STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT);
        
        /* column information */
        REGISTER_LONG_CONSTANT("MYSQLI_NOT_NULL_FLAG", NOT_NULL_FLAG, CONST_CS | CONST_PERSISTENT);
index 237eabedb15d71554a073032747bb130435e4eac..6197328d7ddaa6318785ba43785a71bfd93e3ac0 100644 (file)
@@ -240,7 +240,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
        
        var_cnt = argc - start;
 
-       if (var_cnt != stmt->stmt->field_count) {
+       if (var_cnt != mysql_stmt_field_count(stmt->stmt)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of bind variables doesn't match number of fields in prepared statmement.");
                efree(args);
                RETURN_FALSE;
@@ -321,11 +321,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
                }
        }
 
-#ifndef HAVE_MYSQLI_OLDAPI     
        rc = mysql_stmt_bind_result(stmt->stmt, bind);
-#else
-       rc = mysql_bind_result(stmt->stmt, bind);
-#endif
        MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
 
        if (rc) {
@@ -565,11 +561,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
                        }       
                }
        }
-#ifndef HAVE_MYSQLI_OLDAPI     
        if (mysql_stmt_execute(stmt->stmt)) {
-#else
-       if (mysql_execute(stmt->stmt)) {
-#endif
                MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
                RETURN_FALSE;
        }
@@ -607,11 +599,7 @@ PHP_FUNCTION(mysqli_stmt_fetch)
                        memset(stmt->result.buf[i].val, 0, stmt->result.buf[i].buflen);
                }
        }
-#ifndef HAVE_MYSQLI_OLDAPI     
        if (!(ret = mysql_stmt_fetch(stmt->stmt))) {
-#else
-       if (!(ret = mysql_fetch(stmt->stmt))) {
-#endif
                for (i = 0; i < stmt->result.var_cnt; i++) {
                        if (stmt->result.vars[i]->type == IS_STRING && stmt->result.vars[i]->value.str.len) {
                        efree(stmt->result.vars[i]->value.str.val);
@@ -1213,25 +1201,6 @@ PHP_FUNCTION(mysqli_options)
 }   
 /* }}} */
 
-/* {{{ proto int mysqli_param_count(object stmt) {
-   Return the number of parameter for the given statement */
-PHP_FUNCTION(mysqli_stmt_param_count)
-{
-       MY_STMT         *stmt;
-       zval            *mysql_stmt;
-       
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
-               return;
-       }
-       MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); 
-               
-#ifndef HAVE_MYSQLI_OLDAPI     
-       RETURN_LONG(mysql_stmt_param_count(stmt->stmt));
-#else
-       RETURN_LONG(mysql_param_count(stmt->stmt));
-#endif
-}
-/* }}} */
 
 /* {{{ proto bool mysqli_ping(object link)
    Ping a server connection or reconnect if there is no connection */
@@ -1445,11 +1414,7 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter number");
                RETURN_FALSE;
        }
-#ifndef HAVE_MYSQLI_OLDAPI     
        if (mysql_stmt_send_long_data(stmt->stmt, param_nr, data, data_len)) {
-#else
-       if (mysql_send_long_data(stmt->stmt, param_nr, data, data_len)) {
-#endif
                RETURN_FALSE;
        }
        RETURN_TRUE;
@@ -1547,7 +1512,22 @@ PHP_FUNCTION(mysqli_stmt_data_seek)
 }
 /* }}} */
 
-#ifndef HAVE_MYSQLI_OLDAPI
+/* {{{ proto int mysqli_stmt_field_count(object stmt) {
+   Return the number of result columns for the given statement */
+PHP_FUNCTION(mysqli_stmt_field_count)
+{
+       MY_STMT         *stmt;
+       zval            *mysql_stmt;
+       
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+               return;
+       }
+       MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); 
+               
+       RETURN_LONG(mysql_stmt_field_count(stmt->stmt));
+}
+/* }}} */
+
 /* {{{ proto void mysqli_stmt_free_result(object stmt)
    Free stored result memory for the given statement handle */
 PHP_FUNCTION(mysqli_stmt_free_result) 
@@ -1584,6 +1564,22 @@ PHP_FUNCTION(mysqli_stmt_insert_id)
 }
 /* }}} */
 
+/* {{{ proto int mysqli_stmt_param_count(object stmt) {
+   Return the number of parameter for the given statement */
+PHP_FUNCTION(mysqli_stmt_param_count)
+{
+       MY_STMT         *stmt;
+       zval            *mysql_stmt;
+       
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+               return;
+       }
+       MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); 
+               
+       RETURN_LONG(mysql_stmt_param_count(stmt->stmt));
+}
+/* }}} */
+
 /* {{{ proto void mysqli_stmt_reset(object stmt)
    reset a prepared statement */
 PHP_FUNCTION(mysqli_stmt_reset) 
@@ -1602,7 +1598,6 @@ PHP_FUNCTION(mysqli_stmt_reset)
        return;
 }
 /* }}} */
-#endif
 
 /* {{{ proto mixed mysqli_stmt_num_rows(object stmt)
    Return the number of rows in statements result set */
@@ -1649,7 +1644,6 @@ PHP_FUNCTION(mysqli_select_db)
 
 /* {{{ proto string mysqli_sqlstate(object link)
    Returns the SQLSTATE error from previous MySQL operation */
-#if MYSQL_VERSION_ID >= 40101
 PHP_FUNCTION(mysqli_sqlstate) 
 {
        MY_MYSQL        *mysql;
@@ -1661,7 +1655,6 @@ PHP_FUNCTION(mysqli_sqlstate)
        MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link");
        RETURN_STRING((char *)mysql_sqlstate(mysql->mysql),1);
 }
-#endif
 /* }}} */
 
 /* {{{ proto bool mysqli_ssl_set(object link ,string key ,string cert ,string ca ,string capath ,string cipher])
@@ -1711,6 +1704,50 @@ PHP_FUNCTION(mysqli_stat)
 
 /* }}} */
  
+/* {{{ proto int mysqli_stmt_attr_set(object stmt, long attr, bool mode)
+*/
+PHP_FUNCTION(mysqli_stmt_attr_set)
+{
+       MY_STMT *stmt;
+       zval    *mysql_stmt;
+       ulong   mode;
+       ulong   attr;
+       int             rc;
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olb", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode) == FAILURE) {
+               return;
+       }
+       MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); 
+
+       if (rc = mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) {
+               RETURN_FALSE;
+       }
+       RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto int mysqli_stmt_attr_get(object stmt, long attr)
+*/
+PHP_FUNCTION(mysqli_stmt_attr_get)
+{
+       MY_STMT *stmt;
+       zval    *mysql_stmt;
+       ulong   value;
+       ulong   attr;
+       int             rc;
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) {
+               return;
+       }
+       MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); 
+
+       if (rc = mysql_stmt_attr_get(stmt->stmt, attr, &value)) {
+               RETURN_FALSE;
+       }
+       RETURN_LONG(value);
+}
+/* }}} */
+
 /* {{{ proto int mysqli_stmt_errno(object stmt)
 */
 PHP_FUNCTION(mysqli_stmt_errno)
@@ -1808,11 +1845,7 @@ PHP_FUNCTION(mysqli_stmt_result_metadata)
        }
        MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); 
 
-#ifndef HAVE_MYSQLI_OLDAPI     
        if (!(result = mysql_stmt_result_metadata(stmt->stmt))){
-#else
-       if (!(result = mysql_get_metadata(stmt->stmt))){
-#endif
                MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
                RETURN_FALSE;
        }
index 3ceaba1c35e83a45911a251c40176095ed25bc39..2510e86432b32ff9e609cca3f886eba12be4146e 100644 (file)
@@ -117,20 +117,19 @@ function_entry mysqli_functions[] = {
        PHP_FE(mysqli_rpl_probe,                                                        NULL)
        PHP_FE(mysqli_rpl_query_type,                                           NULL)
        PHP_FE(mysqli_select_db,                                                        NULL)
-#ifndef HAVE_MYSQLI_OLDAPI
+       PHP_FE(mysqli_stmt_attr_get,                                            NULL)
+       PHP_FE(mysqli_stmt_attr_set,                                            NULL)
+       PHP_FE(mysqli_stmt_field_count,                                         NULL)
        PHP_FE(mysqli_stmt_init,                                                        NULL)
        PHP_FE(mysqli_stmt_prepare,                                                     NULL)
-#endif
        PHP_FE(mysqli_stmt_result_metadata,                                     NULL)
        PHP_FE(mysqli_stmt_send_long_data,                                      NULL)
        PHP_FE(mysqli_stmt_bind_param,                                          third_arg_force_by_ref_rest)
        PHP_FE(mysqli_stmt_bind_result,                                         second_arg_force_by_ref_rest)
        PHP_FE(mysqli_stmt_fetch,                                                       NULL)
-#ifndef HAVE_MYSQLI_OLDAPI
        PHP_FE(mysqli_stmt_free_result,                                         NULL)
        PHP_FE(mysqli_stmt_insert_id,                                           NULL)
        PHP_FE(mysqli_stmt_reset,                                                       NULL)
-#endif
        PHP_FE(mysqli_stmt_param_count,                                         NULL)
        PHP_FE(mysqli_send_query,                                                       NULL)
 #ifdef HAVE_EMBEDDED_MYSQLI
@@ -138,9 +137,7 @@ function_entry mysqli_functions[] = {
        PHP_FE(mysqli_server_init,                                                      NULL)
 #endif
        PHP_FE(mysqli_slave_query,                                                      NULL)
-#if MYSQL_VERSION_ID >= 40101
        PHP_FE(mysqli_sqlstate,                                                         NULL)
-#endif
        PHP_FE(mysqli_ssl_set,                                                          NULL)
        PHP_FE(mysqli_stat,                                                                     NULL)
        PHP_FE(mysqli_stmt_affected_rows,                                       NULL)
@@ -149,9 +146,7 @@ function_entry mysqli_functions[] = {
        PHP_FE(mysqli_stmt_errno,                                                       NULL)
        PHP_FE(mysqli_stmt_error,                                                       NULL)
        PHP_FE(mysqli_stmt_num_rows,                                            NULL)
-#if MYSQL_VERSION_ID >= 40101
        PHP_FE(mysqli_stmt_sqlstate,                                            NULL)
-#endif
        PHP_FE(mysqli_store_result,                                                     NULL)
        PHP_FE(mysqli_stmt_store_result,                                        NULL)
        PHP_FE(mysqli_thread_id,                                                        NULL)
@@ -226,9 +221,7 @@ function_entry mysqli_link_methods[] = {
        PHP_FALIAS(slave_query,mysqli_slave_query,NULL)
        PHP_FALIAS(ssl_set,mysqli_ssl_set,NULL)
        PHP_FALIAS(stat,mysqli_stat,NULL)
-#ifndef HAVE_MYSQLI_OLDAPI
        PHP_FALIAS(stmt_init,mysqli_stmt_init, NULL)
-#endif
        PHP_FALIAS(store_result,mysqli_store_result,NULL)
        PHP_FALIAS(thread_safe,mysqli_thread_safe,NULL)
        PHP_FALIAS(use_result,mysqli_use_result,NULL)
@@ -263,7 +256,8 @@ function_entry mysqli_result_methods[] = {
  * Every user visible function must have an entry in mysqli_stmt_functions[].
  */
 function_entry mysqli_stmt_methods[] = {
-       PHP_FALIAS(affected_rows,mysqli_stmt_affected_rows,NULL)
+       PHP_FALIAS(attr_get,mysqli_stmt_attr_get,NULL)
+       PHP_FALIAS(attr_set,mysqli_stmt_attr_set,NULL)
        PHP_FALIAS(bind_param,mysqli_stmt_bind_param,second_arg_force_by_ref_rest)
        PHP_FALIAS(bind_result,mysqli_stmt_bind_result,all_args_force_by_ref)
        PHP_FALIAS(close,mysqli_stmt_close,NULL)
@@ -274,11 +268,9 @@ function_entry mysqli_stmt_methods[] = {
        PHP_FALIAS(num_rows, mysqli_stmt_num_rows,NULL)
        PHP_FALIAS(send_long_data,mysqli_stmt_send_long_data,NULL)
        PHP_FALIAS(stmt,mysqli_prepare,NULL)
-#ifndef HAVE_MYSQLI_OLDAPI
        PHP_FALIAS(free_result,mysqli_stmt_free_result,NULL)
        PHP_FALIAS(reset,mysqli_stmt_reset,NULL)
        PHP_FALIAS(prepare,mysqli_stmt_prepare, NULL)
-#endif
        PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)
        {NULL, NULL, NULL}
 };
index 8db43bcd494fc6cc1f7d2e61346ada2c543fb9c4..c9d3f8d8ecbf4b2f5eb282123d62182b151549ea 100644 (file)
@@ -87,6 +87,19 @@ int link_client_version_read(mysqli_object *obj, zval **retval TSRMLS_DC)
 }
 /* }}} */
 
+/* {{{ property link_test_read */
+int link_test_read(mysqli_object *obj, zval **retval TSRMLS_DC)
+{
+       long    i;
+       ALLOC_ZVAL(*retval);
+       array_init(*retval);
+
+       for (i=0; i < 10; i++)
+               add_index_long(*retval, i, i + 10);
+       return SUCCESS;
+}
+/*i }}} */
+
 /* {{{ property link_connect_errno_read */
 int link_connect_errno_read(mysqli_object *obj, zval **retval TSRMLS_DC)
 {
@@ -171,7 +184,7 @@ MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_affected_rows_read, mysql_stmt_affected_rows,
 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(), my_ulonglong);
 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(), my_ulonglong);
 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(), ulong);
-//MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(), ulong);
+MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(), ulong);
 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(), ulong);
 MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT());
 MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT());
@@ -179,6 +192,7 @@ MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_
 mysqli_property_entry mysqli_link_property_entries[] = {
        {"affected_rows", link_affected_rows_read, NULL},
        {"client_version", link_client_version_read, NULL},
+       {"test", link_test_read, NULL},
        {"connect_errno", link_connect_errno_read, NULL},
        {"connect_error", link_connect_error_read, NULL},
        {"errno", link_errno_read, NULL},
@@ -212,9 +226,9 @@ mysqli_property_entry mysqli_stmt_property_entries[] = {
        {"param_count", stmt_param_count_read, NULL},
 
 /*  TODO: stmt->field_count doesn't work currently, remove comments until mysqli_stmt_field_count
-    is implemented in client library 
-       {"field_count", stmt_field_count_read, NULL},
+    is implemented in client library
 */
+       {"field_count", stmt_field_count_read, NULL},
 
        {"errno", stmt_errno_read, NULL},
        {"error", stmt_error_read, NULL},
index ac7725f92a1ad429c7df32c881335221c0fb1f6d..a21d21a9f09d5eb1515b1e15a6f3cdbc5bf02db0 100644 (file)
@@ -52,7 +52,6 @@ void php_mysqli_report_error(char *sqlstate, int errorno, char *error TSRMLS_DC)
 
 /* {{{ void php_mysqli_report_index() */ 
 void php_mysqli_report_index(char *query, unsigned int status TSRMLS_DC) {
-#if MYSQL_VERSION_ID > 40101
        char index[15];
 
        if (status & SERVER_QUERY_NO_GOOD_INDEX_USED) {
@@ -63,9 +62,6 @@ void php_mysqli_report_index(char *query, unsigned int status TSRMLS_DC) {
                return;
        }
        php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s used in query/prepared statement %s", index, query);
-#else
-       return;
-#endif
 }
 /* }}} */
 
index 5d19b0e7443a0d62b4ccab9da3b6b202c9663870..c5a090fa2e29a7fe744ba1c1a512c1ba02ee6438 100644 (file)
@@ -334,13 +334,14 @@ PHP_FUNCTION(mysqli_rpl_parse_enabled);
 PHP_FUNCTION(mysqli_rpl_probe);
 PHP_FUNCTION(mysqli_rpl_query_type);
 PHP_FUNCTION(mysqli_select_db);
+PHP_FUNCTION(mysqli_stmt_attr_get);
+PHP_FUNCTION(mysqli_stmt_attr_set);
 PHP_FUNCTION(mysqli_stmt_bind_param);
 PHP_FUNCTION(mysqli_stmt_bind_result);
 PHP_FUNCTION(mysqli_stmt_execute);
-#ifndef MYSQLI_HAVE_OLDAPI
+PHP_FUNCTION(mysqli_stmt_field_count);
 PHP_FUNCTION(mysqli_stmt_init);
 PHP_FUNCTION(mysqli_stmt_prepare);
-#endif
 PHP_FUNCTION(mysqli_stmt_fetch);
 PHP_FUNCTION(mysqli_stmt_param_count);
 PHP_FUNCTION(mysqli_stmt_send_long_data);
@@ -350,9 +351,7 @@ PHP_FUNCTION(mysqli_server_init);
 PHP_FUNCTION(mysqli_server_end);
 #endif
 PHP_FUNCTION(mysqli_slave_query);
-#if MYSQL_VERSION_ID >= 40101
 PHP_FUNCTION(mysqli_sqlstate);
-#endif
 PHP_FUNCTION(mysqli_ssl_set);
 PHP_FUNCTION(mysqli_stat);
 PHP_FUNCTION(mysqli_stmt_affected_rows);
@@ -360,15 +359,11 @@ PHP_FUNCTION(mysqli_stmt_close);
 PHP_FUNCTION(mysqli_stmt_data_seek);
 PHP_FUNCTION(mysqli_stmt_errno);
 PHP_FUNCTION(mysqli_stmt_error);
-#ifndef HAVE_MYSQLI_OLDAPI
 PHP_FUNCTION(mysqli_stmt_free_result);
 PHP_FUNCTION(mysqli_stmt_reset);
-#endif
 PHP_FUNCTION(mysqli_stmt_insert_id);
 PHP_FUNCTION(mysqli_stmt_num_rows);
-#if MYSQL_VERSION_ID >= 40101
 PHP_FUNCTION(mysqli_stmt_sqlstate);
-#endif
 PHP_FUNCTION(mysqli_stmt_store_result);
 PHP_FUNCTION(mysqli_store_result);
 PHP_FUNCTION(mysqli_thread_id);