List:Commits« Previous MessageNext Message »
From:Georg Richter Date:July 25 2009 3:44pm
Subject:bzr commit into libmysql branch (georg.richter:2859) Bug#46206
View as plain text  
#At file:///home/georg/work/mysql/connectors/connector-c/ based on revid:georg.richter@stripped

 2859 Georg Richter	2009-07-25
      Fix for bug #46206
      - added missing HAVE_COMPRESS definition
      - added test

    modified:
      CMakeLists.txt
      unittest/libmysql/connection.c
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2009-07-25 13:02:44 +0000
+++ b/CMakeLists.txt	2009-07-25 15:44:20 +0000
@@ -281,6 +281,8 @@ ELSE(WITH_EXTERNAL_ZLIB)
   SET(ZLIB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/extlib/zlib")
   ADD_SUBDIRECTORY(extlib/zlib)
 ENDIF(WITH_EXTERNAL_ZLIB)
+ADD_DEFINITIONS(-D HAVE_COMPRESS)
+
 ADD_SUBDIRECTORY(mysys)
 IF(NOT SKIP_SSL)
   IF(NOT WITH_OPENSSL)

=== modified file 'unittest/libmysql/connection.c'
--- a/unittest/libmysql/connection.c	2009-03-10 09:32:30 +0000
+++ b/unittest/libmysql/connection.c	2009-07-25 15:44:20 +0000
@@ -447,6 +447,43 @@ static int test_opt_reconnect(MYSQL *mys
   return OK;
 }
 
+static int test_compress(MYSQL *mysql)
+{
+  MYSQL_RES *res;
+  MYSQL_ROW row;
+  int rc;
+
+#ifndef CLIENT_COMPRESS
+  diag("client compression not supported");
+  return SKIP;
+#endif
+
+  mysql= mysql_init(NULL);
+  FAIL_IF(!mysql, "not enough memory");
+
+  /* use compressed protocol */
+  rc= mysql_options(mysql, MYSQL_OPT_COMPRESS, NULL);
+
+
+
+  if (!(mysql_real_connect(mysql, hostname, username,
+                           password, schema, port,
+                           socketname, 0)))
+  {
+    diag("connection failed");
+    return FAIL;
+  }
+
+  rc= mysql_query(mysql, "SHOW STATUS LIKE 'compression'");
+  check_mysql_rc(rc, mysql);
+  res= mysql_store_result(mysql);
+  row= mysql_fetch_row(res);
+  FAIL_UNLESS(strcmp(row[1], "ON") == 0, "Compression off");
+  mysql_free_result(res);
+
+  mysql_close(mysql);
+  return OK;
+}
 
 struct my_tests_st my_tests[] = {
   {"test_bug20023", test_bug20023, TEST_CONNECTION_NEW, 0, NULL,  NULL},
@@ -454,6 +491,7 @@ struct my_tests_st my_tests[] = {
   {"test_bug33831", test_bug33831, TEST_CONNECTION_NEW, 0, NULL,  NULL},
   {"test_change_user", test_change_user, TEST_CONNECTION_NEW, 0, NULL,  NULL},
   {"test_opt_reconnect", test_opt_reconnect, TEST_CONNECTION_NONE, 0, NULL,  NULL},
+  {"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL,  NULL},
   {NULL, NULL, 0, 0, NULL, NULL}
 };
 


Attachment: [text/bzr-bundle] bzr/georg.richter@sun.com-20090725154420-m412bra1l5d615v7.bundle
Thread
bzr commit into libmysql branch (georg.richter:2859) Bug#46206Georg Richter25 Jul