diff options
| author | Olivier Bertrand <bertrandop@gmail.com> | 2013-10-27 10:37:12 +0100 |
|---|---|---|
| committer | Olivier Bertrand <bertrandop@gmail.com> | 2013-10-27 10:37:12 +0100 |
| commit | bb597a765dff8da39c3c4a907eee6a9e3a75489a (patch) | |
| tree | 8c9a4acb8728e4634d1df04a4e05dbf2be3d5c6d /storage/connect/tabmysql.cpp | |
| parent | 0f6bcf73de25040c442cec62ddcdbe7f1d43040b (diff) | |
| download | mariadb-git-bb597a765dff8da39c3c4a907eee6a9e3a75489a.tar.gz | |
- Add test on MYSQL table self reference during CREATE TABLE
Fix option other ignored when parsing URL
modified:
storage/connect/ha_connect.cc
storage/connect/mysql-test/connect/t/mysql.test
storage/connect/mysql-test/connect/t/mysql_grant.test
storage/connect/tabmysql.cpp
storage/connect/tabmysql.h
Diffstat (limited to 'storage/connect/tabmysql.cpp')
| -rw-r--r-- | storage/connect/tabmysql.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 28da47d2d33..f37cb6d349e 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -172,7 +172,7 @@ bool MYSQLDEF::GetServerInfo(PGLOBAL g, const char *server_name) /* true error */ /* */ /***********************************************************************/ -bool MYSQLDEF::ParseURL(PGLOBAL g, char *url) +bool MYSQLDEF::ParseURL(PGLOBAL g, char *url, bool b) { if ((!strstr(url, "://") && (!strchr(url, '@')))) { // No :// or @ in connection string. Must be a straight @@ -249,34 +249,41 @@ bool MYSQLDEF::ParseURL(PGLOBAL g, char *url) if ((Database = strchr(Hostname, '/'))) { *Database++ = 0; - if ((Tabname = strchr(Database, '/'))) + if ((Tabname = strchr(Database, '/'))) { *Tabname++ = 0; - // Make sure there's not an extra / - if ((strchr(Tabname, '/'))) { - strcpy(g->Message, "Syntax error in URL"); - return true; - } // endif / + // Make sure there's not an extra / + if ((strchr(Tabname, '/'))) { + strcpy(g->Message, "Syntax error in URL"); + return true; + } // endif / + + } // endif Tabname } // endif database if ((sport = strchr(Hostname, ':'))) *sport++ = 0; - Portnumber = (sport && sport[0]) ? atoi(sport) : GetDefaultPort(); + // For unspecified values, get the values of old style options + // but only if called from MYSQLDEF, else set them to NULL + Portnumber = (sport && sport[0]) ? atoi(sport) + : (b) ? Cat->GetIntCatInfo("Port", GetDefaultPort()) : 0; if (Username[0] == 0) - Username = Cat->GetStringCatInfo(g, "User", "*"); + Username = (b) ? Cat->GetStringCatInfo(g, "User", "*") : NULL; if (Hostname[0] == 0) - Hostname = Cat->GetStringCatInfo(g, "Host", "localhost"); + Hostname = (b) ? Cat->GetStringCatInfo(g, "Host", "localhost") : NULL; if (!Database || !*Database) - Database = Cat->GetStringCatInfo(g, "Database", "*"); + Database = (b) ? Cat->GetStringCatInfo(g, "Database", "*") : NULL; if (!Tabname || !*Tabname) - Tabname = Name; + Tabname = (b) ? Cat->GetStringCatInfo(g, "Tabname", Name) : NULL; + if (!Password) + Password = (b) ? Cat->GetStringCatInfo(g, "Password", NULL) : NULL; } // endif URL #if 0 |
