]> granicus.if.org Git - php/commitdiff
ported mysql and mysqlnd
authorAnatol Belski <ab@php.net>
Tue, 19 Aug 2014 14:51:06 +0000 (16:51 +0200)
committerAnatol Belski <ab@php.net>
Tue, 19 Aug 2014 14:51:06 +0000 (16:51 +0200)
20 files changed:
ext/mysql/php_mysql.c
ext/mysql/php_mysql_structs.h
ext/mysqlnd/mysqlnd.c
ext/mysqlnd/mysqlnd.h
ext/mysqlnd/mysqlnd_alloc.c
ext/mysqlnd/mysqlnd_auth.c
ext/mysqlnd/mysqlnd_charset.c
ext/mysqlnd/mysqlnd_charset.h
ext/mysqlnd/mysqlnd_net.c
ext/mysqlnd/mysqlnd_portability.h
ext/mysqlnd/mysqlnd_priv.h
ext/mysqlnd/mysqlnd_ps.c
ext/mysqlnd/mysqlnd_ps_codec.c
ext/mysqlnd/mysqlnd_result.c
ext/mysqlnd/mysqlnd_result_meta.c
ext/mysqlnd/mysqlnd_structs.h
ext/mysqlnd/mysqlnd_wireprotocol.c
ext/mysqlnd/mysqlnd_wireprotocol.h
ext/mysqlnd/php_mysqlnd.c
ext/pgsql/tests/config.inc

index d492147c7f8eac1c2159e4da1f0ca3f34cb52a14..b0596c396a9d2b2b6d9dd1feb0189aa2324a7517 100644 (file)
@@ -80,7 +80,7 @@ static int le_result, le_link, le_plink;
 #define SAFE_STRING(s) ((s)?(s):"")
 
 #if MYSQL_VERSION_ID > 32199 || defined(MYSQL_USE_MYSQLND)
-# define mysql_row_length_type unsigned long
+# define mysql_row_length_type php_uint_t
 # define HAVE_MYSQL_ERRNO
 #else
 # define mysql_row_length_type unsigned int
@@ -727,12 +727,12 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        char *tmp = NULL, *host = NULL;
        int user_len = 0, passwd_len = 0, host_len = 0;
        int port = MYSQL_PORT;
-       long client_flags = 0;
+       php_int_t client_flags = 0;
        php_mysql_conn *mysql = NULL;
 #if MYSQL_VERSION_ID <= 32230
        void (*handler) (int);
 #endif
-       long connect_timeout;
+       php_int_t connect_timeout;
        zend_string *hashed_details = NULL;
        zend_bool free_host = 0, new_link = 0;
 
@@ -780,13 +780,13 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        } else {
                /* mysql_pconnect does not support new_link parameter */
                if (persistent) {
-                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!l", &host_and_port, &host_len,
+                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!i", &host_and_port, &host_len,
                                                                        &user, &user_len, &passwd, &passwd_len,
                                                                        &client_flags)==FAILURE) {
                                return;
                }
                } else {
-                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bl", &host_and_port, &host_len,
+                       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bi", &host_and_port, &host_len,
                                                                                &user, &user_len, &passwd, &passwd_len,
                                                                                &new_link, &client_flags)==FAILURE) {
                                return;
@@ -1927,7 +1927,7 @@ PHP_FUNCTION(mysql_insert_id)
 PHP_FUNCTION(mysql_result)
 {
        zval *result, *field=NULL;
-       long row;
+       php_int_t row;
        MYSQL_RES *mysql_result;
 #ifndef MYSQL_USE_MYSQLND
        MYSQL_ROW sql_row;
@@ -1940,7 +1940,7 @@ johannes TODO:
 Do 2 zend_parse_parameters calls instead of type "z" and switch below
 Q: String or long first?
 */
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result, &row, &field) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri|z", &result, &row, &field) == FAILURE) {
                return;
        }
 
@@ -2063,7 +2063,7 @@ PHP_FUNCTION(mysql_num_fields)
 
 /* {{{ php_mysql_fetch_hash
  */
-static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type, int expected_args, int into_object)
+static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, php_int_t result_type, int expected_args, int into_object)
 {
        MYSQL_RES *mysql_result;
        zval *res, *ctor_params = NULL;
@@ -2096,7 +2096,7 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
        } else
 #endif
        {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &res, &result_type) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &res, &result_type) == FAILURE) {
                        return;
                }
                if (!result_type) {
@@ -2271,10 +2271,10 @@ PHP_FUNCTION(mysql_fetch_assoc)
 PHP_FUNCTION(mysql_data_seek)
 {
        zval *result;
-       long offset;
+       php_int_t offset;
        MYSQL_RES *mysql_result;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset)) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset)) {
                return;
        }
 
@@ -2398,11 +2398,11 @@ static char *php_mysql_get_field_name(int field_type)
 PHP_FUNCTION(mysql_fetch_field)
 {
        zval *result;
-       long field=0;
+       php_int_t field=0;
        MYSQL_RES *mysql_result;
        const MYSQL_FIELD *mysql_field;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &field) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|i", &result, &field) == FAILURE) {
                return;
        }
 
@@ -2445,10 +2445,10 @@ PHP_FUNCTION(mysql_fetch_field)
 PHP_FUNCTION(mysql_field_seek)
 {
        zval *result;
-       long offset;
+       php_int_t offset;
        MYSQL_RES *mysql_result;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &offset) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &offset) == FAILURE) {
                return;
        }
        ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
@@ -2473,13 +2473,13 @@ PHP_FUNCTION(mysql_field_seek)
 static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
 {
        zval *result;
-       long field;
+       php_int_t field;
        MYSQL_RES *mysql_result;
        const MYSQL_FIELD *mysql_field = {0};
        char buf[512];
        int  len;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ri", &result, &field) == FAILURE) {
                return;
        }
 
index 0e8ab482a156366f22eca40501d68ef2c84dac01..0f4dbec110b972bdaf4f0d3d85032c35332a2981 100644 (file)
@@ -112,18 +112,18 @@ PHP_FUNCTION(mysql_set_charset);
 
 ZEND_BEGIN_MODULE_GLOBALS(mysql)
        zend_resource *default_link;
-       long num_links,num_persistent;
-       long max_links,max_persistent;
-       long allow_persistent;
-       long default_port;
+       php_int_t num_links,num_persistent;
+       php_int_t max_links,max_persistent;
+       php_int_t allow_persistent;
+       php_int_t default_port;
        char *default_host, *default_user, *default_password;
        char *default_socket;
        char *connect_error;
-       long connect_errno;
-       long connect_timeout;
-       long result_allocated;
-       long trace_mode;
-       long allow_local_infile;
+       php_int_t connect_errno;
+       php_int_t connect_timeout;
+       php_int_t result_allocated;
+       php_int_t trace_mode;
+       php_int_t allow_local_infile;
 ZEND_END_MODULE_GLOBALS(mysql)
 
 #ifdef ZTS
index e05d6844bc05befead1ecd69fd634d4b0fc5b3a5..65752d74a865099dd395d77e4cd2f54ad45a55f7 100644 (file)
@@ -440,7 +440,7 @@ mysqlnd_switch_to_ssl_if_needed(
                        MYSQLND_CONN_DATA * conn,
                        const MYSQLND_PACKET_GREET * const greet_packet,
                        const MYSQLND_OPTIONS * const options,
-                       unsigned long mysql_flags
+                       php_uint_t mysql_flags
                        TSRMLS_DC
                )
 {
@@ -546,7 +546,7 @@ mysqlnd_run_authentication(
                        const char * const auth_protocol,
                        unsigned int charset_no,
                        const MYSQLND_OPTIONS * const options,
-                       unsigned long mysql_flags,
+                       php_uint_t mysql_flags,
                        zend_bool silent,
                        zend_bool is_change_user
                        TSRMLS_DC)
@@ -678,7 +678,7 @@ mysqlnd_connect_run_authentication(
                        size_t passwd_len,
                        const MYSQLND_PACKET_GREET * const greet_packet,
                        const MYSQLND_OPTIONS * const options,
-                       unsigned long mysql_flags
+                       php_uint_t mysql_flags
                        TSRMLS_DC)
 {
        enum_func_status ret = FAIL;
@@ -1588,7 +1588,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, sqlstate)(const MYSQLND_CONN_DATA * const conn
 
 
 /* {{{ mysqlnd_old_escape_string */
-PHPAPI ulong 
+PHPAPI  php_uint_t
 mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC)
 {
        DBG_ENTER("mysqlnd_old_escape_string");
@@ -1622,11 +1622,11 @@ MYSQLND_METHOD(mysqlnd_conn_data, ssl_set)(MYSQLND_CONN_DATA * const conn, const
 
 
 /* {{{ mysqlnd_conn_data::escape_string */
-static ulong
+static php_uint_t
 MYSQLND_METHOD(mysqlnd_conn_data, escape_string)(MYSQLND_CONN_DATA * const conn, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC)
 {
        size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, escape_string);
-       ulong ret = FAIL;
+       php_uint_t ret = FAIL;
        DBG_ENTER("mysqlnd_conn_data::escape_string");
        DBG_INF_FMT("conn=%llu", conn->thread_id);
 
@@ -2114,23 +2114,23 @@ MYSQLND_METHOD(mysqlnd_conn_data, thread_id)(const MYSQLND_CONN_DATA * const con
 
 
 /* {{{ mysqlnd_conn_data::get_server_version */
-static unsigned long
+static php_uint_t
 MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC)
 {
-       long major, minor, patch;
+       php_int_t major, minor, patch;
        char *p;
 
        if (!(p = conn->server_version)) {
                return 0;
        }
 
-       major = strtol(p, &p, 10);
+       major = ZEND_STRTOI(p, &p, 10);
        p += 1; /* consume the dot */
-       minor = strtol(p, &p, 10);
+       minor = ZEND_STRTOI(p, &p, 10);
        p += 1; /* consume the dot */
-       patch = strtol(p, &p, 10);
+       patch = ZEND_STRTOI(p, &p, 10);
 
-       return (unsigned long)(major * 10000L + (unsigned long)(minor * 100L + patch));
+       return (php_uint_t)(major * Z_I(10000) + (php_uint_t)(minor * Z_I(100) + patch));
 }
 /* }}} */
 
index 94620d9369f4db4e2c2bce25184117a62c250793..f79dc37a3e2fd3c4d3cd8df0b581c72223a4f39b 100644 (file)
@@ -219,7 +219,7 @@ void mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn);
 #define mysqlnd_escape_string(newstr, escapestr, escapestr_len) \
                mysqlnd_old_escape_string((newstr), (escapestr), (escapestr_len) TSRMLS_CC)
 
-PHPAPI ulong mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
+PHPAPI php_uint_t mysqlnd_old_escape_string(char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
 
 
 /* PS */
@@ -270,17 +270,17 @@ ZEND_BEGIN_MODULE_GLOBALS(mysqlnd)
        char *                  trace_alloc_settings;   /* The actual string */
        MYSQLND_DEBUG * dbg;    /* The DBG object for standard tracing */
        MYSQLND_DEBUG * trace_alloc;    /* The DBG object for allocation tracing */
-       long                    net_cmd_buffer_size;
-       long                    net_read_buffer_size;
-       long                    log_mask;
-       long                    net_read_timeout;
-       long                    mempool_default_size;
-       long                    debug_emalloc_fail_threshold;
-       long                    debug_ecalloc_fail_threshold;
-       long                    debug_erealloc_fail_threshold;
-       long                    debug_malloc_fail_threshold;
-       long                    debug_calloc_fail_threshold;
-       long                    debug_realloc_fail_threshold;
+       php_int_t               net_cmd_buffer_size;
+       php_int_t               net_read_buffer_size;
+       php_int_t               log_mask;
+       php_int_t               net_read_timeout;
+       php_int_t               mempool_default_size;
+       php_int_t               debug_emalloc_fail_threshold;
+       php_int_t               debug_ecalloc_fail_threshold;
+       php_int_t               debug_erealloc_fail_threshold;
+       php_int_t               debug_malloc_fail_threshold;
+       php_int_t               debug_calloc_fail_threshold;
+       php_int_t               debug_realloc_fail_threshold;
        char *                  sha256_server_public_key;
        zend_bool               fetch_data_copy;
 ZEND_END_MODULE_GLOBALS(mysqlnd)
index c3228aa4f101e49bc6c69176d61c3bee1271c00e..903753ef89f193a143c0f0b971721cd36910755f 100644 (file)
@@ -79,7 +79,7 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)
        void *ret;
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 #if PHP_DEBUG
-       long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold);
+       php_int_t * threshold = &MYSQLND_G(debug_emalloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_emalloc_name);
 
@@ -119,7 +119,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D)
        void *ret;
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 #if PHP_DEBUG
-       long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold);
+       php_int_t * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name);
 
@@ -162,7 +162,7 @@ void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
        void *ret;
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 #if PHP_DEBUG
-       long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold);
+       php_int_t * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name);
 
@@ -203,7 +203,7 @@ void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, zend_bool persistent M
        void *ret;
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 #if PHP_DEBUG
-       long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold);
+       php_int_t * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name);
 #if PHP_DEBUG
@@ -246,7 +246,7 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D)
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
        size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 #if PHP_DEBUG
-       long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold);
+       php_int_t * threshold = &MYSQLND_G(debug_erealloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_erealloc_name);
 
@@ -287,7 +287,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
        size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
 #if PHP_DEBUG
-       long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold);
+       php_int_t * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_perealloc_name);
 
@@ -393,7 +393,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D)
        void *ret;
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 #if PHP_DEBUG
-       long * threshold = &MYSQLND_G(debug_malloc_fail_threshold);
+       php_int_t * threshold = &MYSQLND_G(debug_malloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_malloc_name);
 
@@ -432,7 +432,7 @@ void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
        void *ret;
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 #if PHP_DEBUG
-       long * threshold = &MYSQLND_G(debug_calloc_fail_threshold);
+       php_int_t * threshold = &MYSQLND_G(debug_calloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_calloc_name);
 
@@ -471,7 +471,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D)
        void *ret;
        zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
 #if PHP_DEBUG
-       long * threshold = &MYSQLND_G(debug_realloc_fail_threshold);
+       php_int_t * threshold = &MYSQLND_G(debug_realloc_fail_threshold);
 #endif
        TRACE_ALLOC_ENTER(mysqlnd_realloc_name);
 
index 1ac05930f7775ac02b51016cfae0264d69e44f2d..76d4a56f388ea888dc60d7393e280a4b9aee0fc5 100644 (file)
@@ -37,7 +37,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
                                                          const char * const db,
                                                          const size_t db_len,
                                                          const MYSQLND_OPTIONS * const options,
-                                                         unsigned long mysql_flags,
+                                                         php_uint_t mysql_flags,
                                                          unsigned int server_charset_no,
                                                          zend_bool use_full_blown_auth_packet,
                                                          const char * const auth_protocol,
@@ -361,7 +361,7 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
                                                                  const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
                                                                  const MYSQLND_OPTIONS * const options,
                                                                  const MYSQLND_NET_OPTIONS * const net_options,
-                                                                 unsigned long mysql_flags
+                                                                 php_uint_t mysql_flags
                                                                  TSRMLS_DC)
 {
        zend_uchar * ret = NULL;
@@ -421,7 +421,7 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
                                                           const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
                                                           const MYSQLND_OPTIONS * const options,
                                                           const MYSQLND_NET_OPTIONS * const net_options,
-                                                          unsigned long mysql_flags
+                                                          php_uint_t mysql_flags
                                                           TSRMLS_DC)
 {
        zend_uchar * ret = NULL;
@@ -571,7 +571,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
                                                                  const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
                                                                  const MYSQLND_OPTIONS * const options,
                                                                  const MYSQLND_NET_OPTIONS * const net_options,
-                                                                 unsigned long mysql_flags
+                                                                 php_uint_t mysql_flags
                                                                  TSRMLS_DC)
 {
        RSA * server_public_key;
index dfa90db255fcbf8f819ffc75a4d3e01efd825fe7..fa97b877e56926f21dca937881c627072f0182cb 100644 (file)
@@ -726,7 +726,7 @@ PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char * const name
 
 
 /* {{{ mysqlnd_cset_escape_quotes */
-PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr,
+PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char *newstr,
                                                                                const char * escapestr, size_t escapestr_len TSRMLS_DC)
 {
        const char      *newstr_s = newstr;
@@ -780,7 +780,7 @@ PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset, char
 
 
 /* {{{ mysqlnd_cset_escape_slashes */
-PHPAPI ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
+PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
                                                                                 const char * escapestr, size_t escapestr_len TSRMLS_DC)
 {
        const char      *newstr_s = newstr;
index cf3eada8af901b35b8cab49466f9deacec926cf5..0a7ced68aae543055836d054e225dc73cdb2b403 100644 (file)
 #ifndef MYSQLND_CHARSET_H
 #define MYSQLND_CHARSET_H
 
-PHPAPI ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr,
+PHPAPI php_uint_t mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char *newstr,
                                                                                const char *escapestr, size_t escapestr_len TSRMLS_DC);
 
-PHPAPI ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
+PHPAPI php_uint_t mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char *newstr,
                                                                                 const char *escapestr, size_t escapestr_len TSRMLS_DC);
 
 struct st_mysqlnd_plugin_charsets
@@ -34,8 +34,8 @@ struct st_mysqlnd_plugin_charsets
        {
                const MYSQLND_CHARSET * (*const find_charset_by_nr)(unsigned int charsetnr);
                const MYSQLND_CHARSET * (*const find_charset_by_name)(const char * const name);
-               unsigned long                   (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
-               unsigned long                   (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
+               php_uint_t                      (*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
+               php_uint_t                      (*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, size_t escapestr_len TSRMLS_DC);
        } methods;
 };
 
index 84757f88c128bcb88ea3dce5c51572a69f200370..e014f86390109dbd6c8ce87992df7ccd1b5ca034 100644 (file)
@@ -676,7 +676,7 @@ MYSQLND_METHOD(mysqlnd_net, receive_ex)(MYSQLND_NET * const net, zend_uchar * co
                        }
                        net->compressed_envelope_packet_no++;
 #ifdef MYSQLND_DUMP_HEADER_N_BODY
-                       DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (unsigned long) net_payload_size);
+                       DBG_INF_FMT("HEADER: hwd_packet_no=%u size=%3u", packet_no, (php_uint_t) net_payload_size);
 #endif
                        /* Now let's read from the wire, decompress it and fill the read buffer */
                        net->data->m.read_compressed_packet_from_stream_and_fill_read_buffer(net, net_payload_size, conn_stats, error_info TSRMLS_CC);
index 72a156a79500d40438b66f60396b65498fcfa9cf..d9936e04253e602e5589af3c7ed2e1f56cac9484 100644 (file)
@@ -194,13 +194,13 @@ This file is public domain and comes with NO WARRANTY of any kind */
                    (((uint32_t) (zend_uchar) (A)[2]) << 16) |\
                    (((uint32_t) (zend_uchar) (A)[1]) << 8) | \
                     ((uint32_t) (zend_uchar) (A)[0])))
-#define sint4korr(A)  (*((long *) (A)))
+#define sint4korr(A)  (*((php_int_t *) (A)))
 
 #define uint2korr(A)  (*((uint16_t *) (A)))
 #define uint3korr(A)  (uint32_t) (((uint32_t) ((zend_uchar) (A)[0])) +\
                                (((uint32_t) ((zend_uchar) (A)[1])) << 8) +\
                                (((uint32_t) ((zend_uchar) (A)[2])) << 16))
-#define uint4korr(A)  (*((unsigned long *) (A)))
+#define uint4korr(A)  (*((php_uint_t *) (A)))
 
 
 
@@ -211,7 +211,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
                   *(T)=  (zend_uchar) ((A));\
                   *(T+1)=(zend_uchar) (((uint32_t) (A) >> 8));\
                   *(T+2)=(zend_uchar) (((A) >> 16)); }
-#define int4store(T,A)    *((long *) (T))= (long) (A)
+#define int4store(T,A)    *((php_int_t *) (T))= (php_int_t) (A)
 #define int5store(T,A)    { \
               *((zend_uchar *)(T))= (zend_uchar)((A));\
               *(((zend_uchar *)(T))+1)=(zend_uchar) (((A) >> 8));\
@@ -232,12 +232,12 @@ This file is public domain and comes with NO WARRANTY of any kind */
 
 typedef union {
   double v;
-  long m[2];
+  php_int_t m[2];
 } float8get_union;
-#define float8get(V,M)    { ((float8get_union *)&(V))->m[0] = *((long*) (M)); \
-                            ((float8get_union *)&(V))->m[1] = *(((long*) (M))+1); }
-#define float8store(T,V) { *((long *) (T))     = ((float8get_union *)&(V))->m[0]; \
-                           *(((long *) (T))+1) = ((float8get_union *)&(V))->m[1]; }
+#define float8get(V,M)    { ((float8get_union *)&(V))->m[0] = *((php_int_t*) (M)); \
+                            ((float8get_union *)&(V))->m[1] = *(((php_int_t*) (M))+1); }
+#define float8store(T,V) { *((php_int_t *) (T))     = ((float8get_union *)&(V))->m[0]; \
+                           *(((php_int_t *) (T))+1) = ((float8get_union *)&(V))->m[1]; }
 #define float4get(V,M) { *((float *) &(V)) = *((float*) (M)); }
 /* From Andrey Hristov based on float8get */
 #define floatget(V,M)    memcpy((char*) &(V),(char*) (M),sizeof(float))
index 536b37caa7cb4ac9a273f43ff153e4c2e5d2d445..475a33d38e5e30a25b48afd0f04a86528f93756e 100644 (file)
@@ -209,7 +209,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
                                                const char * const db,
                                                const size_t db_len,
                                                const MYSQLND_OPTIONS * const options,
-                                               unsigned long mysql_flags,
+                                               php_uint_t mysql_flags,
                                                unsigned int server_charset_no,
                                                zend_bool use_full_blown_auth_packet,
                                                const char * const auth_protocol,
index 33c78f1bbed46fc1dc66e6b46cf3f0786cca8be5..6edaa20c60510b57ab146a43be7d9c1c5068cd05 100644 (file)
@@ -776,7 +776,7 @@ mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int
                                                          Thus for NULL and zero-length we are quite efficient.
                                                        */
                                                        if (Z_TYPE(current_row[i]) == IS_STRING) {
-                                                               unsigned long len = Z_STRSIZE(current_row[i]);
+                                                               php_uint_t len = Z_STRSIZE(current_row[i]);
                                                                if (meta->fields[i].max_length < len) {
                                                                        meta->fields[i].max_length = len;
                                                                }
@@ -1302,7 +1302,7 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC)
 /* {{{ mysqlnd_stmt::send_long_data */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned int param_no,
-                                                                                        const char * const data, unsigned long length TSRMLS_DC)
+                                                                                        const char * const data, php_uint_t length TSRMLS_DC)
 {
        MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
        enum_func_status ret = FAIL;
@@ -1927,10 +1927,10 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_get)(const MYSQLND_STMT * const s,
                        *(zend_bool *) value= stmt->update_max_length;
                        break;
                case STMT_ATTR_CURSOR_TYPE:
-                       *(unsigned long *) value= stmt->flags;
+                       *(php_uint_t *) value= stmt->flags;
                        break;
                case STMT_ATTR_PREFETCH_ROWS:
-                       *(unsigned long *) value= stmt->prefetch_rows;
+                       *(php_uint_t *) value= stmt->prefetch_rows;
                        break;
                default:
                        DBG_RETURN(FAIL);
index 6f160d22239784c5160b35d36dcf7afd76dd8d23..8b59d918bada3bed71b269c2e10070444d75bdc1 100644 (file)
@@ -41,7 +41,7 @@ enum mysqlnd_timestamp_type
 struct st_mysqlnd_time
 {
   unsigned int  year, month, day, hour, minute, second;
-  unsigned long second_part;
+  php_uint_t second_part;
   zend_bool     neg;
   enum mysqlnd_timestamp_type time_type;
 };
@@ -76,7 +76,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne
                        case 1:uval = (uint64_t) uint1korr(*row);break;
                }
 
-#if SIZEOF_LONG==4
+#if SIZEOF_ZEND_INT==4
                if (uval > INT_MAX) {
                        DBG_INF("stringify");
                        tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval);
@@ -84,7 +84,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne
 #endif /* #if SIZEOF_LONG==4 */
                {
                        if (byte_count < 8 || uval <= L64(9223372036854775807)) {
-                               ZVAL_INT(zv, (long) uval); /* the cast is safe, we are in the range */
+                               ZVAL_INT(zv, (php_int_t) uval); /* the cast is safe, we are in the range */
                        } else {
                                DBG_INF("stringify");
                                tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval);
@@ -105,14 +105,14 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigne
                        case 1:lval = (int64_t) *(int8_t*)*row;break;
                }
 
-#if SIZEOF_LONG==4
+#if SIZEOF_ZEND_INT==4
                if ((L64(2147483647) < (int64_t) lval) || (L64(-2147483648) > (int64_t) lval)) {
                        DBG_INF("stringify");
                        tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval);
                } else
 #endif /* SIZEOF */
                {
-                       ZVAL_INT(zv, (long) lval); /* the cast is safe, we are in the range */
+                       ZVAL_INT(zv, (php_int_t) lval); /* the cast is safe, we are in the range */
                }
        }
 
@@ -246,7 +246,7 @@ static void
 ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
 {
        struct st_mysqlnd_time t;
-       unsigned long length; /* First byte encodes the length*/
+       php_uint_t length; /* First byte encodes the length*/
        char * value;
        DBG_ENTER("ps_fetch_time");
 
@@ -256,11 +256,11 @@ ps_fetch_time(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_le
                t.time_type = MYSQLND_TIMESTAMP_TIME;
                t.neg                   = (zend_bool) to[0];
 
-               t.day                   = (unsigned long) sint4korr(to+1);
+               t.day                   = (php_uint_t) sint4korr(to+1);
                t.hour                  = (unsigned int) to[5];
                t.minute                = (unsigned int) to[6];
                t.second                = (unsigned int) to[7];
-               t.second_part   = (length > 8) ? (unsigned long) sint4korr(to+8) : 0;
+               t.second_part   = (length > 8) ? (php_uint_t) sint4korr(to+8) : 0;
                t.year                  = t.month= 0;
                if (t.day) {
                        /* Convert days to hours at once */
@@ -289,7 +289,7 @@ static void
 ps_fetch_date(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
 {
        struct st_mysqlnd_time t = {0};
-       unsigned long length; /* First byte encodes the length*/
+       php_uint_t length; /* First byte encodes the length*/
        char * value;
        DBG_ENTER("ps_fetch_date");
 
@@ -326,7 +326,7 @@ static void
 ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
 {
        struct st_mysqlnd_time t;
-       unsigned long length; /* First byte encodes the length*/
+       php_uint_t length; /* First byte encodes the length*/
        char * value;
        DBG_ENTER("ps_fetch_datetime");
 
@@ -347,7 +347,7 @@ ps_fetch_datetime(zval * zv, const MYSQLND_FIELD * const field, unsigned int pac
                } else {
                        t.hour = t.minute = t.second= 0;
                }
-               t.second_part = (length > 7) ? (unsigned long) sint4korr(to+7) : 0;
+               t.second_part = (length > 7) ? (php_uint_t) sint4korr(to+7) : 0;
 
                (*row)+= length;
        } else {
@@ -373,7 +373,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_
          For now just copy, before we make it possible
          to write \0 to the row buffer
        */
-       const unsigned long length = php_mysqlnd_net_field_length(row);
+       const php_uint_t length = php_mysqlnd_net_field_length(row);
        DBG_ENTER("ps_fetch_string");
        DBG_INF_FMT("len = %lu", length);
        DBG_INF("copying from the row buffer");
@@ -389,7 +389,7 @@ ps_fetch_string(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_
 static void
 ps_fetch_bit(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row TSRMLS_DC)
 {
-       unsigned long length = php_mysqlnd_net_field_length(row);
+       php_uint_t length = php_mysqlnd_net_field_length(row);
        ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, length TSRMLS_CC);
 }
 /* }}} */
@@ -636,7 +636,7 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie
                                  Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX
                                  We do transformation here, which will be used later when sending types. The code later relies on this.
                                */
-                               if (Z_DVAL(tmp_data_copy) > LONG_MAX || Z_DVAL(tmp_data_copy) < LONG_MIN) {
+                               if (Z_DVAL(tmp_data_copy) > PHP_INT_MAX || Z_DVAL(tmp_data_copy) < PHP_INT_MIN) {
                                        stmt->send_types_to_server = *resend_types_next_time = 1;
                                        convert_to_string_ex(tmp_data);
                                } else {
@@ -663,7 +663,7 @@ mysqlnd_stmt_execute_store_types(MYSQLND_STMT_DATA * stmt, zval * copies, zend_u
                short current_type = stmt->param_bind[i].type;
                zval *parameter = &stmt->param_bind[i].zv;
                /* our types are not unsigned */
-#if SIZEOF_LONG==8  
+#if SIZEOF_ZEND_INT==8  
                if (current_type == MYSQL_TYPE_LONG) {
                        current_type = MYSQL_TYPE_LONGLONG;
                }
index 8fb89fddf80988cc5958e5dedf80ec10ebb71a55..00611079c197427bc223bf764839a3a019ec9bca 100644 (file)
@@ -71,7 +71,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, initialize_result_set_rest)(MYSQLND
                                  Thus for NULL and zero-length we are quite efficient.
                                */
                                if (Z_TYPE(data_cursor[i]) == IS_STRING) {
-                                       unsigned long len = Z_STRSIZE(data_cursor[i]);
+                                       php_uint_t len = Z_STRSIZE(data_cursor[i]);
                                        if (meta->fields[i].max_length < len) {
                                                meta->fields[i].max_length = len;
                                        }
@@ -126,7 +126,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, initialize_result_set_rest)(MYSQLND_RE
                                  Thus for NULL and zero-length we are quite efficient.
                                */
                                if (Z_TYPE(current_row[i]) == IS_STRING) {
-                                       unsigned long len = Z_STRSIZE(current_row[i]);
+                                       php_uint_t len = Z_STRSIZE(current_row[i]);
                                        if (meta->fields[i].max_length < len) {
                                                meta->fields[i].max_length = len;
                                        }
@@ -599,7 +599,7 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s
   of PHP, to be called as separate function. But let's have it for
   completeness.
 */
-static unsigned long *
+static php_uint_t *
 MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC)
 {
        const MYSQLND_RES_BUFFERED_ZVAL * set = (MYSQLND_RES_BUFFERED_ZVAL *) result;
@@ -631,7 +631,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_lengths)(MYSQLND_RES_BUFFERED
   of PHP, to be called as separate function. But let's have it for
   completeness.
 */
-static unsigned long *
+static php_uint_t *
 MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC)
 {
        const MYSQLND_RES_BUFFERED_C * set = (MYSQLND_RES_BUFFERED_C *) result;
@@ -648,7 +648,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_lengths)(MYSQLND_RES_BUFFERED *
 
 
 /* {{{ mysqlnd_result_unbuffered::fetch_lengths */
-static unsigned long *
+static php_uint_t *
 MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC)
 {
        /* simulate output of libmysql */
@@ -658,10 +658,10 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_lengths)(MYSQLND_RES_UNBUFFERED
 
 
 /* {{{ mysqlnd_res::fetch_lengths */
-static unsigned long *
+static php_uint_t *
 MYSQLND_METHOD(mysqlnd_res, fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC)
 {
-       unsigned long * ret;
+       php_uint_t * ret;
        DBG_ENTER("mysqlnd_res::fetch_lengths");
        ret = result->stored_data && result->stored_data->m.fetch_lengths ?
                                        result->stored_data->m.fetch_lengths(result->stored_data TSRMLS_CC) :
@@ -731,7 +731,7 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row_c)(MYSQLND_RES * result, voi
                                *row = mnd_malloc(field_count * sizeof(char *));
                                if (*row) {
                                        MYSQLND_FIELD * field = meta->fields;
-                                       unsigned long * lengths = result->unbuf->lengths;
+                                       php_uint_t * lengths = result->unbuf->lengths;
 
                                        for (i = 0; i < field_count; i++, field++) {
                                                zval * data = &result->unbuf->last_row_data[i];
@@ -849,7 +849,7 @@ MYSQLND_METHOD(mysqlnd_result_unbuffered, fetch_row)(MYSQLND_RES * result, void
                        {
                                HashTable * row_ht = Z_ARRVAL_P(row);
                                MYSQLND_FIELD * field = meta->fields;
-                               unsigned long * lengths = result->unbuf->lengths;
+                               php_uint_t * lengths = result->unbuf->lengths;
 
                                for (i = 0; i < field_count; i++, field++) {
                                        zval * data = &result->unbuf->last_row_data[i];
@@ -1002,7 +1002,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered, fetch_row_c)(MYSQLND_RES * result, void
                                          Thus for NULL and zero-length we are quite efficient.
                                        */
                                        if (Z_TYPE(current_row[i]) == IS_STRING) {
-                                               unsigned long len = Z_STRSIZE(current_row[i]);
+                                               php_uint_t len = Z_STRSIZE(current_row[i]);
                                                if (meta->fields[i].max_length < len) {
                                                        meta->fields[i].max_length = len;
                                                }
@@ -1093,7 +1093,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_zval, fetch_row)(MYSQLND_RES * result, vo
                                  Thus for NULL and zero-length we are quite efficient.
                                */
                                if (Z_TYPE(current_row[i]) == IS_STRING) {
-                                       unsigned long len = Z_STRSIZE(current_row[i]);
+                                       php_uint_t len = Z_STRSIZE(current_row[i]);
                                        if (meta->fields[i].max_length < len) {
                                                meta->fields[i].max_length = len;
                                        }
@@ -1188,7 +1188,7 @@ MYSQLND_METHOD(mysqlnd_result_buffered_c, fetch_row)(MYSQLND_RES * result, void
                                  Thus for NULL and zero-length we are quite efficient.
                                */
                                if (Z_TYPE(current_row[i]) == IS_STRING) {
-                                       unsigned long len = Z_STRSIZE(current_row[i]);
+                                       php_uint_t len = Z_STRSIZE(current_row[i]);
                                        if (meta->fields[i].max_length < len) {
                                                meta->fields[i].max_length = len;
                                        }
@@ -1776,7 +1776,7 @@ static void
 MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES * result, const unsigned int flags, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC)
 {
        zval  row;
-       ulong i = 0;
+       php_uint_t i = 0;
        MYSQLND_RES_BUFFERED *set = result->stored_data;
 
        DBG_ENTER("mysqlnd_res::fetch_all");
@@ -1927,7 +1927,7 @@ mysqlnd_result_unbuffered_init(unsigned int field_count, zend_bool ps, zend_bool
                DBG_RETURN(NULL);
        }
 
-       if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(unsigned long), persistent))) {
+       if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) {
                mnd_pefree(ret, persistent);
                DBG_RETURN(NULL);
        }
@@ -2010,7 +2010,7 @@ mysqlnd_result_buffered_c_init(unsigned int field_count, zend_bool ps, zend_bool
        if (!ret) {
                DBG_RETURN(NULL);
        }
-       if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(unsigned long), persistent))) {
+       if (!(ret->lengths = mnd_pecalloc(field_count, sizeof(php_uint_t), persistent))) {
                mnd_pefree(ret, persistent);
                DBG_RETURN(NULL);
        }
index f6e38c809ebd963ca25a9d463cc646ad238832da..ac7526d22ddcf068c4b4b92f29f4a1b455f0d7a3 100644 (file)
@@ -64,7 +64,7 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met
        }
        field_packet->persistent_alloc = meta->persistent;
        for (;i < meta->field_count; i++) {
-               long idx;
+               php_int_t idx;
 
                if (meta->fields[i].root) {
                        /* We re-read metadata for PS */
index 9ec924ead6bdac21e83663cae19a092c03692746..87270a93c8ede1c7484d9236410f751c5144aaf7 100644 (file)
@@ -80,8 +80,8 @@ typedef struct st_mysqlnd_field
        const char  *db;                        /* Database for table */
        const char  *catalog;           /* Catalog for table */
        char  *def;                 /* Default value (set by mysql_list_fields) */
-       unsigned long length;           /* Width of column (create length) */
-       unsigned long max_length;       /* Max width for selected set */
+       php_uint_t length;              /* Width of column (create length) */
+       php_uint_t max_length;  /* Max width for selected set */
        unsigned int name_length;
        unsigned int org_name_length;
        unsigned int table_length;
@@ -414,7 +414,7 @@ struct st_mysqlnd_object_factory_methods
 
 typedef enum_func_status       (*func_mysqlnd_conn_data__init)(MYSQLND_CONN_DATA * conn TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_conn_data__connect)(MYSQLND_CONN_DATA * conn, const char * host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC);
-typedef ulong                          (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC);
+typedef php_int_t                              (*func_mysqlnd_conn_data__escape_string)(MYSQLND_CONN_DATA * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_conn_data__set_charset)(MYSQLND_CONN_DATA * const conn, const char * const charset TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_conn_data__query)(MYSQLND_CONN_DATA * conn, const char * query, unsigned int query_len TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_conn_data__send_query)(MYSQLND_CONN_DATA * conn, const char *query, unsigned int query_len TSRMLS_DC);
@@ -441,7 +441,7 @@ typedef const char *                (*func_mysqlnd_conn_data__get_sqlstate)(const MYSQLND_CONN
 typedef uint64_t                       (*func_mysqlnd_conn_data__get_thread_id)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
 typedef void                           (*func_mysqlnd_conn_data__get_statistics)(const MYSQLND_CONN_DATA * const conn, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC);
 
-typedef unsigned long          (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
+typedef php_uint_t             (*func_mysqlnd_conn_data__get_server_version)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
 typedef const char *           (*func_mysqlnd_conn_data__get_server_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_conn_data__get_server_statistics)(MYSQLND_CONN_DATA * conn, zend_string **message TSRMLS_DC);
 typedef const char *           (*func_mysqlnd_conn_data__get_host_information)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC);
@@ -639,7 +639,7 @@ typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_field_direct)(MYSQLND_RES
 typedef const MYSQLND_FIELD *(*func_mysqlnd_res__fetch_fields)(MYSQLND_RES * const result TSRMLS_DC);
 
 typedef enum_func_status       (*func_mysqlnd_res__read_result_metadata)(MYSQLND_RES * result, MYSQLND_CONN_DATA * conn TSRMLS_DC);
-typedef unsigned long *                (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC);
+typedef php_uint_t *           (*func_mysqlnd_res__fetch_lengths)(MYSQLND_RES * const result TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_res__store_result_fetch_data)(MYSQLND_CONN_DATA * const conn, MYSQLND_RES * result, MYSQLND_RES_METADATA * meta, MYSQLND_MEMORY_POOL_CHUNK *** row_buffers, zend_bool binary_protocol TSRMLS_DC);
 
 typedef void                           (*func_mysqlnd_res__free_result_buffers)(MYSQLND_RES * result TSRMLS_DC);       /* private */
@@ -690,7 +690,7 @@ struct st_mysqlnd_res_methods
 
 
 typedef uint64_t                       (*func_mysqlnd_result_unbuffered__num_rows)(const MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC);
-typedef unsigned long *                (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC);
+typedef php_uint_t *           (*func_mysqlnd_result_unbuffered__fetch_lengths)(MYSQLND_RES_UNBUFFERED * const result TSRMLS_DC);
 typedef void                           (*func_mysqlnd_result_unbuffered__free_last_data)(MYSQLND_RES_UNBUFFERED * result, MYSQLND_STATS * const global_stats TSRMLS_DC);
 typedef void                           (*func_mysqlnd_result_unbuffered__free_result)(MYSQLND_RES_UNBUFFERED * const result, MYSQLND_STATS * const global_stats TSRMLS_DC);
 
@@ -707,7 +707,7 @@ struct st_mysqlnd_result_unbuffered_methods
 typedef uint64_t                       (*func_mysqlnd_result_buffered__num_rows)(const MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_result_buffered__initialize_result_set_rest)(MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta,
                                                                                                                                                                                MYSQLND_STATS * stats, zend_bool int_and_float_native TSRMLS_DC);
-typedef unsigned long *                (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
+typedef php_uint_t *           (*func_mysqlnd_result_buffered__fetch_lengths)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_result_buffered__data_seek)(MYSQLND_RES_BUFFERED * const result, const uint64_t row TSRMLS_DC);
 typedef void                           (*func_mysqlnd_result_buffered__free_result)(MYSQLND_RES_BUFFERED * const result TSRMLS_DC);
 
@@ -763,7 +763,7 @@ typedef enum_func_status    (*func_mysqlnd_stmt__bind_one_parameter)(MYSQLND_STMT *
 typedef enum_func_status       (*func_mysqlnd_stmt__refresh_bind_param)(MYSQLND_STMT * const stmt TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_stmt__bind_result)(MYSQLND_STMT * const stmt, MYSQLND_RESULT_BIND * const result_bind TSRMLS_DC);
 typedef enum_func_status       (*func_mysqlnd_stmt__bind_one_result)(MYSQLND_STMT * const stmt, unsigned int param_no TSRMLS_DC);
-typedef enum_func_status       (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, unsigned long length TSRMLS_DC);
+typedef enum_func_status       (*func_mysqlnd_stmt__send_long_data)(MYSQLND_STMT * const stmt, unsigned int param_num, const char * const data, php_uint_t length TSRMLS_DC);
 typedef MYSQLND_RES *          (*func_mysqlnd_stmt__get_parameter_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC);
 typedef MYSQLND_RES *          (*func_mysqlnd_stmt__get_result_metadata)(MYSQLND_STMT * const stmt TSRMLS_DC);
 typedef uint64_t                       (*func_mysqlnd_stmt__get_last_insert_id)(const MYSQLND_STMT * const stmt TSRMLS_DC);
@@ -923,10 +923,10 @@ struct st_mysqlnd_connection_data
        unsigned int    connect_or_select_db_len;
        MYSQLND_INFILE  infile;
        unsigned int    protocol_version;
-       unsigned long   max_packet_size;
+       php_uint_t      max_packet_size;
        unsigned int    port;
-       unsigned long   client_flag;
-       unsigned long   server_capabilities;
+       php_uint_t      client_flag;
+       php_uint_t      server_capabilities;
 
        /* For UPSERT queries */
        MYSQLND_UPSERT_STATUS * upsert_status;
@@ -986,7 +986,7 @@ struct st_mysqlnd_connection
 struct mysqlnd_field_hash_key
 {
        zend_bool               is_numeric;
-       unsigned long   key;
+       php_uint_t      key;
 };
 
 
@@ -1011,7 +1011,7 @@ struct st_mysqlnd_result_metadata
        uint64_t                        initialized_rows;                       \
                                                                                                        \
        /*  Column lengths of current row - both buffered and unbuffered. For buffered results it duplicates the data found in **data */ \
-       unsigned long           *lengths;                                       \
+       php_uint_t              *lengths;                                       \
                                                                                                        \
        MYSQLND_MEMORY_POOL     *result_set_memory_pool;        \
                                                                                                        \
@@ -1064,7 +1064,7 @@ struct st_mysqlnd_unbuffered_result
          Column lengths of current row - both buffered and unbuffered.
          For buffered results it duplicates the data found in **data
        */
-       unsigned long           *lengths;
+       php_uint_t              *lengths;
 
        MYSQLND_MEMORY_POOL     *result_set_memory_pool;
 
@@ -1117,8 +1117,8 @@ struct st_mysqlnd_result_bind
 struct st_mysqlnd_stmt_data
 {
        MYSQLND_CONN_DATA                       *conn;
-       unsigned long                           stmt_id;
-       unsigned long                           flags;/* cursor is set here */
+       php_uint_t                              stmt_id;
+       php_uint_t                              flags;/* cursor is set here */
        enum_mysqlnd_stmt_state         state;
        unsigned int                            warning_count;
        MYSQLND_RES                                     *result;
@@ -1137,7 +1137,7 @@ struct st_mysqlnd_stmt_data
        MYSQLND_ERROR_INFO                      error_info_impl;
 
        zend_bool                                       update_max_length;
-       unsigned long                           prefetch_rows;
+       php_uint_t                              prefetch_rows;
 
        zend_bool                                       cursor_exists;
        mysqlnd_stmt_use_or_store_func default_rset_handler;
@@ -1166,7 +1166,7 @@ struct st_mysqlnd_plugin_header
 {
        unsigned int    plugin_api_version; 
        const char *    plugin_name;
-       unsigned long   plugin_version;
+       php_uint_t      plugin_version;
        const char *    plugin_string_version;
        const char *    plugin_license;
        const char *    plugin_author;
@@ -1203,7 +1203,7 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
                                                                                                                MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
                                                                                                                const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
                                                                                                                const MYSQLND_OPTIONS * const options, 
-                                                                                                               const MYSQLND_NET_OPTIONS * const net_options, unsigned long mysql_flags
+                                                                                                               const MYSQLND_NET_OPTIONS * const net_options, php_uint_t mysql_flags
                                                                                                                TSRMLS_DC);
 
 struct st_mysqlnd_authentication_plugin
index a67ff39080daa2a676354e4ca47bcbcadd9c00dd..8d283ba1b357275efd876ce655b5d712b2fb6979 100644 (file)
@@ -126,14 +126,14 @@ static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_L
 
 /* {{{ php_mysqlnd_net_field_length
    Get next field's length */
-unsigned long
+php_uint_t
 php_mysqlnd_net_field_length(zend_uchar **packet)
 {
        register zend_uchar *p= (zend_uchar *)*packet;
 
        if (*p < 251) {
                (*packet)++;
-               return (unsigned long) *p;
+               return (php_uint_t) *p;
        }
 
        switch (*p) {
@@ -142,13 +142,13 @@ php_mysqlnd_net_field_length(zend_uchar **packet)
                        return MYSQLND_NULL_LENGTH;
                case 252:
                        (*packet) += 3;
-                       return (unsigned long) uint2korr(p+1);
+                       return (php_uint_t) uint2korr(p+1);
                case 253:
                        (*packet) += 4;
-                       return (unsigned long) uint3korr(p+1);
+                       return (php_uint_t) uint3korr(p+1);
                default:
                        (*packet) += 9;
-                       return (unsigned long) uint4korr(p+1);
+                       return (php_uint_t) uint4korr(p+1);
        }
 }
 /* }}} */
@@ -567,7 +567,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
                        while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {
                                char *s_key;
                                unsigned int s_len;
-                               unsigned long num_key;
+                               php_uint_t num_key;
                                size_t value_len = strlen(*entry_value);
                                
                                if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {
@@ -582,7 +582,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
 
                        {
                                zend_string * key;
-                               unsigned long unused_num_key;
+                               php_uint_t unused_num_key;
                                zval * entry_value;
                                ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) {
                                        if (key) { /* HASH_KEY_IS_STRING */
@@ -604,7 +604,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
                                while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {
                                        char *s_key;
                                        unsigned int s_len;
-                                       unsigned long num_key;
+                                       php_uint_t num_key;
                                        size_t value_len = strlen(*entry_value);
                                        if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {
                                                /* copy key */
@@ -621,7 +621,7 @@ size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC
 #else
                                {
                                        zend_string * key;
-                                       unsigned long unused_num_key;
+                                       php_uint_t unused_num_key;
                                        zval * entry_value;
                                        ZEND_HASH_FOREACH_KEY_VAL(packet->connect_attr, unused_num_key, key, entry_value) {
                                                if (key) { /* HASH_KEY_IS_STRING */
@@ -685,7 +685,7 @@ php_mysqlnd_auth_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_D
        zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf;
        zend_uchar *p = buf;
        zend_uchar *begin = buf;
-       unsigned long i;
+       php_uint_t i;
        register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet;
 
        DBG_ENTER("php_mysqlnd_auth_response_read");
@@ -753,7 +753,7 @@ php_mysqlnd_auth_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_D
                        packet->message_len = 0;
                }
 
-               DBG_INF_FMT("OK packet: aff_rows=%lld last_ins_id=%ld server_status=%u warnings=%u",
+               DBG_INF_FMT("OK packet: aff_rows=%lld last_ins_id=%pd server_status=%u warnings=%u",
                                        packet->affected_rows, packet->last_insert_id, packet->server_status,
                                        packet->warning_count);
        }
@@ -848,7 +848,7 @@ php_mysqlnd_ok_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
        zend_uchar *buf = conn->net->cmd_buffer.buffer? (zend_uchar *) conn->net->cmd_buffer.buffer : local_buf;
        zend_uchar *p = buf;
        zend_uchar *begin = buf;
-       unsigned long i;
+       php_uint_t i;
        register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet;
 
        DBG_ENTER("php_mysqlnd_ok_read");
@@ -1230,7 +1230,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
        zend_uchar *p = buf;
        zend_uchar *begin = buf;
        char *root_ptr;
-       unsigned long len;
+       php_uint_t len;
        MYSQLND_FIELD *meta;
        unsigned int i, field_count = sizeof(rset_field_offsets)/sizeof(size_t);
 
@@ -1622,7 +1622,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
 
        for (i = 0, current_field = start_field; current_field < end_field; current_field++, i++) {
                /* php_mysqlnd_net_field_length() call should be after *this_field_len_pos = p; */
-               unsigned long len = php_mysqlnd_net_field_length(&p);
+               php_uint_t len = php_mysqlnd_net_field_length(&p);
 
                /* NULL or NOT NULL, this is the question! */
                if (len == MYSQLND_NULL_LENGTH) {
@@ -1671,7 +1671,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
                                zend_uchar save = *(p + len);
                                /* We have to make it ASCIIZ temporarily */
                                *(p + len) = '\0';
-                               if (perm_bind.pack_len < SIZEOF_LONG) {
+                               if (perm_bind.pack_len < SIZEOF_ZEND_INT) {
                                        /* direct conversion */
                                        int64_t v =
 #ifndef PHP_WIN32
@@ -1679,7 +1679,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
 #else
                                                _atoi64((char *) p);
 #endif
-                                       ZVAL_INT(current_field, (long) v); /* the cast is safe */
+                                       ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */
                                } else {
                                        uint64_t v =
 #ifndef PHP_WIN32
@@ -1689,9 +1689,9 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
 #endif
                                        zend_bool uns = fields_metadata[i].flags & UNSIGNED_FLAG? TRUE:FALSE;
                                        /* We have to make it ASCIIZ temporarily */
-#if SIZEOF_LONG==8
+#if SIZEOF_ZEND_INT==8
                                        if (uns == TRUE && v > 9223372036854775807L)
-#elif SIZEOF_LONG==4
+#elif SIZEOF_ZEND_INT==4
                                        if ((uns == TRUE && v > L64(2147483647)) ||
                                                (uns == FALSE && (( L64(2147483647) < (int64_t) v) ||
                                                (L64(-2147483648) > (int64_t) v))))
@@ -1701,7 +1701,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
                                        {
                                                ZVAL_STRINGL(current_field, (char *)p, len);
                                        } else {
-                                               ZVAL_INT(current_field, (long) v); /* the cast is safe */
+                                               ZVAL_INT(current_field, (php_int_t) v); /* the cast is safe */
                                        }
                                }
                                *(p + len) = save;
@@ -1731,7 +1731,7 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
                                */
                                p -= len;
                                if (Z_TYPE_P(current_field) == IS_INT) {
-                                       bit_area += 1 + sprintf((char *)start, "%ld", Z_IVAL_P(current_field));
+                                       bit_area += 1 + sprintf((char *)start, ZEND_INT_FMT, Z_IVAL_P(current_field));
                                        ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1);
                                } else if (Z_TYPE_P(current_field) == IS_STRING){
                                        memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRSIZE_P(current_field));
index bd87d9e75742be8de2bcb267199d97080ff52938..059cfb2416f34a7d7451872b3a3f235c2b1c93ee 100644 (file)
@@ -28,7 +28,7 @@
 #define MYSQLND_HEADER_SIZE 4
 #define COMPRESSED_HEADER_SIZE 3
 
-#define MYSQLND_NULL_LENGTH    (unsigned long) ~0
+#define MYSQLND_NULL_LENGTH    (php_uint_t) ~0
 
 /* Used in mysqlnd_debug.c */
 PHPAPI extern const char mysqlnd_read_header_name[];
@@ -185,7 +185,7 @@ typedef struct st_mysqlnd_packet_rset_header {
          error_no != 0 => error
          others => result set -> Read res_field packets up to field_count
        */
-       unsigned long           field_count;
+       php_uint_t              field_count;
        /*
          These are filled if no SELECT query. For SELECT warning_count
          and server status are in the last row packet, the EOF packet.
@@ -258,7 +258,7 @@ typedef struct st_mysqlnd_packet_prepare_response {
        MYSQLND_PACKET_HEADER   header;
        /* also known as field_count 0x00=OK , 0xFF=error */
        unsigned char   error_code;
-       unsigned long   stmt_id;
+       php_uint_t      stmt_id;
        unsigned int    field_count;
        unsigned int    param_count;
        unsigned int    warning_count;
@@ -300,7 +300,7 @@ typedef struct  st_mysqlnd_packet_sha256_pk_request_response {
 
 PHPAPI void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const pass, size_t pass_len);
 
-unsigned long  php_mysqlnd_net_field_length(zend_uchar **packet);
+php_uint_t     php_mysqlnd_net_field_length(zend_uchar **packet);
 zend_uchar *   php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length);
 size_t                 php_mysqlnd_net_store_length_size(uint64_t length);
 
index e0bc6d126df80bb2bbf45f40229fe53293d981dc..95747a7e3ae3c66f70787988daeb17e6f23c25a3 100644 (file)
@@ -138,11 +138,11 @@ PHP_MINFO_FUNCTION(mysqlnd)
 #else
                                                                "not supported");
 #endif
-       snprintf(buf, sizeof(buf), "%ld", MYSQLND_G(net_cmd_buffer_size));
+       snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_cmd_buffer_size));
        php_info_print_table_row(2, "Command buffer size", buf);
-       snprintf(buf, sizeof(buf), "%ld", MYSQLND_G(net_read_buffer_size));
+       snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_read_buffer_size));
        php_info_print_table_row(2, "Read buffer size", buf);
-       snprintf(buf, sizeof(buf), "%ld", MYSQLND_G(net_read_timeout));
+       snprintf(buf, sizeof(buf), "%pd", MYSQLND_G(net_read_timeout));
        php_info_print_table_row(2, "Read timeout", buf);
        php_info_print_table_row(2, "Collecting statistics", MYSQLND_G(collect_statistics)? "Yes":"No");
        php_info_print_table_row(2, "Collecting memory statistics", MYSQLND_G(collect_memory_statistics)? "Yes":"No");
@@ -206,7 +206,9 @@ static PHP_GINIT_FUNCTION(mysqlnd)
  */
 static PHP_INI_MH(OnUpdateNetCmdBufferSize)
 {
-       long long_value = atol(new_value);
+       php_int_t long_value;
+
+       ZEND_ATOI(long_value, new_value);
        if (long_value < MYSQLND_NET_CMD_BUFFER_MIN_SIZE) {
                return FAILURE;
        }
index 367f1ef9ba65e0bbf151f45390a74f1c73ba3c4f..be652b2507ba9836d0f9f52250f32717680087c7 100644 (file)
@@ -4,7 +4,7 @@
 
 // "test" database must be existed. i.e. "createdb test" before testing
 // PostgreSQL uses login name as username, user must have access to "test" database.
-$conn_str        = "host=localhost dbname=test port=5432";    // connection string
+$conn_str        = "user=test password=test host=localhost dbname=test port=5432";    // connection string
 $table_name      = "php_pgsql_test";          // test table that will be created
 $table_name_92   = "php_pgsql_test_92";       // test table that will be created
 $num_test_record = 1000;                      // Number of records to create