=== modified file 'ChangeLog' --- ChangeLog 2009-06-08 02:33:55 +0000 +++ ChangeLog 2009-06-16 11:58:20 +0000 @@ -38,6 +38,7 @@ * Fix positioned update using data-at-execution, bind offsets and row-wise binding. (Bug #36071) * SQLConfigDataSource may fail with: Cannot find driver (Bug #41796) + * Spaces in connection string aren't removed (Bug #45378) Includes changes from Connector/ODBC 3.51.27. === modified file 'test/my_basics.c' --- test/my_basics.c 2009-02-25 19:55:18 +0000 +++ test/my_basics.c 2009-06-16 11:58:20 +0000 @@ -978,6 +978,35 @@ } +/* + Bug#45378 - spaces in connection string aren't removed +*/ +DECLARE_TEST(t_bug45378) +{ + HDBC hdbc1; + SQLCHAR conn[256], conn_out[256]; + SQLSMALLINT conn_out_len; + + sprintf((char *)conn, "DSN=%s; UID = {%s} ;PWD= %s ", + mydsn, myuid, mypwd); + if (mysock != NULL) + { + strcat((char *)conn, ";SOCKET="); + strcat((char *)conn, (char *)mysock); + } + + ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1)); + + ok_con(hdbc1, SQLDriverConnect(hdbc1, NULL, conn, SQL_NTS, conn_out, + sizeof(conn_out), &conn_out_len, + SQL_DRIVER_NOPROMPT)); + ok_con(hdbc1, SQLDisconnect(hdbc1)); + ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1)); + + return OK; +} + + BEGIN_TESTS ADD_TEST(my_basics) ADD_TEST(t_max_select) @@ -1003,6 +1032,7 @@ ADD_TEST(t_bug28820) ADD_TEST(t_bug31959) ADD_TEST(t_bug41256) + ADD_TEST(t_bug45378) END_TESTS === modified file 'util/installer.c' --- util/installer.c 2009-05-02 20:53:50 +0000 +++ util/installer.c 2009-06-16 11:58:20 +0000 @@ -916,6 +916,7 @@ const SQLWCHAR *end; SQLWCHAR **dest; SQLWCHAR attribute[100]; + int len; unsigned int *intdest; BOOL *booldest; @@ -924,9 +925,24 @@ if ((split= sqlwcharchr(attrs, (SQLWCHAR)'=')) == NULL) return 1; - memcpy(attribute, attrs, (split - attrs) * sizeof(SQLWCHAR)); - attribute[split - attrs]= 0; + /* remove leading spaces on attribute */ + while (*attrs == ' ') + attrs++; + len = split - attrs; + memcpy(attribute, attrs, len * sizeof(SQLWCHAR)); + attribute[len]= 0; + /* remove trailing spaces on attribute */ + len--; + while (attribute[len] == ' ') + { + attribute[len] = 0; + len--; + } + split++; + /* remove leading and trailing spaces on value */ + while (*split == ' ') + split++; /* check for an "escaped" value */ if ((*split == '{' && (end= sqlwcharchr(attrs, '}')) == NULL) || @@ -935,6 +951,14 @@ /* otherwise, take the rest of the string */ end= attrs + sqlwcharlen(attrs); + /* remove trailing spaces on value (not escaped part) */ + len = end - split - 1; + while (split[len] == ' ' && split[len+1] != '}') + { + len--; + end--; + } + /* handle deprecated options as an exception */ if (!sqlwcharcasecmp(W_OPTION, attribute)) { @@ -966,7 +990,7 @@ } attrs= end; - if (*end || *end == delim) + while (*attrs == delim || *attrs == ' ') attrs++; }