diff --git a/BUILD.md b/BUILD.md index 92c67cae..9af7d888 100644 --- a/BUILD.md +++ b/BUILD.md @@ -13,6 +13,8 @@ If you need msi package to be generated by the build process, you also need: - WiX Toolset https://wixtoolset.org/releases/ and provide WIX_DIR parameter for cmake with path to WiX binaries, or set WIX env variable with path to WiX installation directory. +If you need 32bit(or 64bit) build, you may need to give cmake -A Win32 parameter(or -A Win64), or specify correct cmake generator name using option -G + ``` git clone https://github.com/MariaDB/mariadb-connector-odbc.git cd mariadb-connector-odbc diff --git a/dsn/odbc_dsn.c b/dsn/odbc_dsn.c index 97b81991..2e7001e4 100644 --- a/dsn/odbc_dsn.c +++ b/dsn/odbc_dsn.c @@ -135,6 +135,17 @@ MADB_OptionsMap OptionsMap[]= { void GetDialogFields(void); HBRUSH hbrBg= NULL; + +void DsnApplyDefaults(MADB_Dsn* Dsn) +{ + /* Setting default port number if Tcp/Ip selected, and the port is 0 */ + if (Dsn->IsTcpIp && Dsn->Port == 0) + { + Dsn->Port = 3306; + } +} + + my_bool SetDialogFields() { int i= 0; @@ -225,8 +236,10 @@ my_bool GetButtonState(int Dialog, int Button) return (my_bool)IsDlgButtonChecked(hwndTab[Dialog], Button); } + my_bool SaveDSN(HWND hDlg, MADB_Dsn *Dsn) { + DsnApplyDefaults(Dsn); if (Dsn->SaveFile != NULL || MADB_SaveDSN(Dsn)) return TRUE; MessageBox(hDlg, Dsn->ErrorMsg, "Error", MB_OK); @@ -475,6 +488,10 @@ static SQLRETURN TestDSN(MADB_Dsn *Dsn, SQLHANDLE *Conn, SQLCHAR *ConnStrBuffer) { ConnStr= ConnStrBuffer; } + + DsnApplyDefaults(Dsn); + /* If defaults has changed actual values - let them be reflected in the dialog */ + SetDialogFields(); MADB_DsnToString(Dsn, ConnStr, CONNSTR_BUFFER_SIZE); SQLAllocHandle(SQL_HANDLE_DBC, Environment, (SQLHANDLE *)&Connection); diff --git a/dsn/odbc_dsn.rc b/dsn/odbc_dsn.rc index 7a19c202..0d38d95e 100644 --- a/dsn/odbc_dsn.rc +++ b/dsn/odbc_dsn.rc @@ -134,7 +134,7 @@ BEGIN LTEXT "Statement(s):",IDC_STATIC,20,17,46,8,0,WS_EX_TRANSPARENT RTEXT "Connection timeout in sec:",IDC_STATIC,17,62,86,8,0,WS_EX_TRANSPARENT EDITTEXT txtConnectionTimeOut,111,60,40,14,ES_AUTOHSCROLL - CONTROL "The client is interactive",cbInteractive,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,62,80,10 + CONTROL "The client is interactive",cbInteractive,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,62,84,10 CONTROL "Enable automatic &reconnect",ckReconnect,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,79,107,10,WS_EX_TRANSPARENT CONTROL "Don't prompt when connecting",ckConnectPrompt,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,95,113,10,WS_EX_TRANSPARENT CONTROL "Use compression",ckCompressed,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,163,79,107,10,WS_EX_TRANSPARENT diff --git a/ma_connection.c b/ma_connection.c index 3b4ddd25..5ff99b2c 100644 --- a/ma_connection.c +++ b/ma_connection.c @@ -798,6 +798,10 @@ SQLRETURN MADB_DbcConnectDB(MADB_Dbc *Connection, else if (Dsn->Port > 0 || Dsn->IsTcpIp) { protocol = MYSQL_PROTOCOL_TCP; + if (Dsn->Port == 0) + { + Dsn->Port= 3306; + } } mysql_optionsv(Connection->mariadb, MYSQL_OPT_PROTOCOL, (void*)&protocol);