]> granicus.if.org Git - php/commitdiff
OPT_COMPRESS support for mysqlnd_conn::set_client_option
authorAndrey Hristov <andrey@php.net>
Wed, 1 Sep 2010 14:47:36 +0000 (14:47 +0000)
committerAndrey Hristov <andrey@php.net>
Wed, 1 Sep 2010 14:47:36 +0000 (14:47 +0000)
To be used by mysqli_options

ext/mysqlnd/mysqlnd.c
ext/mysqlnd/mysqlnd_enum_n_def.h
ext/mysqlnd/mysqlnd_net.c
ext/mysqlnd/mysqlnd_structs.h

index faac95ea86593a02f2c0f5ea8a5eb9bff3b54183..4c7789ac0eb95b00470e205adcc225197dff7301 100644 (file)
@@ -714,6 +714,10 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND * conn,
        if (mysql_flags & CLIENT_COMPRESS) {
                mysql_flags &= ~CLIENT_COMPRESS;
        }
+#else
+       if (conn->net->options.flags & MYSQLND_NET_FLAG_USE_COMPRESSION) {
+               mysql_flags |= CLIENT_COMPRESS;
+       }
 #endif
 #ifndef MYSQLND_SSL_SUPPORTED
        if (mysql_flags & CLIENT_SSL) {
@@ -2034,9 +2038,7 @@ MYSQLND_METHOD(mysqlnd_conn, set_client_option)(MYSQLND * const conn,
        DBG_ENTER("mysqlnd_conn::set_client_option");
        DBG_INF_FMT("conn=%llu option=%u", conn->thread_id, option);
        switch (option) {
-#ifdef WHEN_SUPPORTED_BY_MYSQLI
                case MYSQL_OPT_COMPRESS:
-#endif
 #ifdef WHEN_SUPPORTED_BY_MYSQLI
                case MYSQL_OPT_READ_TIMEOUT:
                case MYSQL_OPT_WRITE_TIMEOUT:
index 5c6a6f25f303d895b523ca2b3c4a8fc0a805e853..a6edb3401c4878be71d88deb936d0ccd663008b3 100644 (file)
@@ -94,6 +94,9 @@
 
 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
 
+
+#define MYSQLND_NET_FLAG_USE_COMPRESSION 1
+
 typedef enum mysqlnd_extension
 {
        MYSQLND_MYSQL = 0,
index 207fa53f0c3e3e0d4974b849f1f7d8f6bbf50aa1..7a65fa14206e9d5d3148da1264343d13f3fe06e5 100644 (file)
@@ -665,10 +665,8 @@ MYSQLND_METHOD(mysqlnd_net, set_client_option)(MYSQLND_NET * const net, enum mys
                        net->options.timeout_write = *(unsigned int*) value;
                        break;
 #endif
-#ifdef WHEN_SUPPORTED_BY_MYSQLI
                case MYSQL_OPT_COMPRESS:
-#endif
-                       /* currently not supported. Todo!! */
+                       net->options.flags |= MYSQLND_NET_FLAG_USE_COMPRESSION;
                        break;
                default:
                        DBG_RETURN(FAIL);
index 426a2067edcc0854faa5acb1634e21fbee32a47e..e1e4cfcc3f371123e8bd4e3e2891540eca3c7f66 100644 (file)
@@ -156,11 +156,18 @@ typedef struct st_mysqlnd_options
          The ABI will be broken and the methods structure will be somewhere else
          in the memory which can crash external code. Feel free to reuse these.
        */
-       char            * unused1;
+#if SIZEOF_CHAR_P == 4
+       uint32_t unused1;
+#elif SIZEOF_CHAR_P == 8
+       uint64_t unused1;
+#else
+#error Not supported platform
+#endif
        char            * unused2;
        char            * unused3;
        char            * unused4;
        char            * unused5;
+
        enum_mysqlnd_protocol_type protocol;
 
        char            *charset_name;
@@ -190,6 +197,7 @@ typedef struct st_mysqlnd_net_options
        char            *ssl_cipher;
        char            *ssl_passphrase;
        zend_bool       ssl_verify_peer;
+       uint64_t        flags;
 } MYSQLND_NET_OPTIONS;