From 11bfe4bfdc79b0374a0f287dac80efa262b365a7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 May 2005 22:57:15 +0000 Subject: [PATCH] allow SQLDriverConnect() to open the dialog asking the user for additional info by passing it a (potentially) non NULL HWND (patch 1092583) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/db.h | 2 ++ src/common/db.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/wx/db.h b/include/wx/db.h index 2b66a88b4a..8f142aee19 100644 --- a/include/wx/db.h +++ b/include/wx/db.h @@ -636,6 +636,8 @@ public: // Data Source Name, User ID, Password and whether open should fail on data type not supported bool Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported=true); + ///This version of Open will open the odbc source selection dialog. Cast a wxWindow::GetHandle() to SQLHWND to use. + bool Open(const wxString& inConnectStr, SQLHWND parentWnd, bool failOnDataTypeUnsupported=true); bool Open(const wxString &Dsn, const wxString &Uid, const wxString &AuthStr, bool failOnDataTypeUnsupported=true); bool Open(wxDbConnectInf *dbConnectInf, bool failOnDataTypeUnsupported=true); bool Open(wxDb *copyDb); // pointer to a wxDb whose connection info should be copied rather than re-queried diff --git a/src/common/db.cpp b/src/common/db.cpp index 97235899a4..290f09fcf3 100644 --- a/src/common/db.cpp +++ b/src/common/db.cpp @@ -804,6 +804,11 @@ bool wxDb::open(bool failOnDataTypeUnsupported) bool wxDb::Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported) { wxASSERT(inConnectStr.Length()); + return Open(inConnectStr, NULL, failOnDataTypeUnsupported); +} + +bool wxDb::Open(const wxString& inConnectStr, SQLHWND parentWnd, bool failOnDataTypeUnsupported) +{ dsn = wxT(""); uid = wxT(""); authStr = wxT(""); @@ -832,7 +837,7 @@ bool wxDb::Open(const wxString& inConnectStr, bool failOnDataTypeUnsupported) inConnectionStr = inConnectStr; - retcode = SQLDriverConnect(hdbc, NULL, (SQLTCHAR FAR *)inConnectionStr.c_str(), + retcode = SQLDriverConnect(hdbc, parentWnd, (SQLTCHAR FAR *)inConnectionStr.c_str(), (SWORD)inConnectionStr.Length(), (SQLTCHAR FAR *)outConnectBuffer, sizeof(outConnectBuffer), &outConnectBufferLen, SQL_DRIVER_COMPLETE ); -- 2.45.2