pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Compilation failure with nmake and MSTDC = no in HEAD
3+ messages / 2 participants
[nested] [flat]

* Compilation failure with nmake and MSTDC = no in HEAD
@ 2015-01-06 05:30 Michael Paquier <michael.paquier@gmail.com>
  2015-01-06 09:40 ` Re: Compilation failure with nmake and MSTDC = no in HEAD Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2015-01-06 05:30 UTC (permalink / raw)
  To: pgsql-odbc

Hi all,

I noticed that the build with nmake is broken when using MSDTC = no
becaus of e85fbb (libpq switch):
setup.c(448) : warning C4013: 'CALL_GetTransactionObject' undefined;
assuming extern returning int
setup.c(448) : warning C4047: '=' : 'void *' differs in levels of
indirection from 'int'
setup.c(465) : warning C4013: 'CALL_ReleaseTransactionObject'
undefined; assuming extern returning int
Attached is a patch fixing the problem, simplifying at the same time
test_connection in setup.c where I think the boolean flag withDtc is
not needed.
Regards,
-- 
Michael

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Attachments:

20150106_nmake_mstdc_fix.patch (text/x-diff, 4.2K) download diff --git a/dlg_wingui.c b/dlg_wingui.c index 0190ccb..bc024c7 100644 --- a/dlg_wingui.c +++ b/dlg_wingui.c @@ -362,7 +362,7 @@ global_optionsProc(HWND hdlg, switch (wMsg) { case WM_INITDIALOG: - SetWindowLongPtr(hdlg, DWLP_USER, lParam); /* save for test etc */ + SetWindowLongPtr(hdlg, DWLP_USER, lParam); /* save for test etc */ CheckDlgButton(hdlg, DRV_COMMLOG, globals.commlog); #ifndef Q_LOG EnableWindow(GetDlgItem(hdlg, DRV_COMMLOG), FALSE); @@ -847,7 +847,7 @@ ds_options3Proc(HWND hdlg, case IDC_TEST: memcpy(&tmpInfo, ci, sizeof(tmpInfo)); ds_options3_update(hdlg, &tmpInfo); - test_connection(hdlg, &tmpInfo, TRUE); + test_connection(hdlg, &tmpInfo); break; case ID1STPAGE: ds_options3_update(hdlg, ci); diff --git a/setup.c b/setup.c index 9177393..33862c0 100644 --- a/setup.c +++ b/setup.c @@ -237,7 +237,7 @@ CenterDialog(HWND hdlg) return; } -void test_connection(HANDLE hwnd, ConnInfo *ci, BOOL withDTC); +void test_connection(HANDLE hwnd, ConnInfo *ci); /*------- * ConfigDlgProc * Description: Manage add data source name dialog @@ -354,7 +354,7 @@ ConfigDlgProc(HWND hdlg, { /* Get Dialog Values */ GetDlgStuff(hdlg, &lpsetupdlg->ci); - test_connection(lpsetupdlg->hwndParent, &lpsetupdlg->ci, FALSE); + test_connection(lpsetupdlg->hwndParent, &lpsetupdlg->ci); return TRUE; } break; @@ -395,7 +395,7 @@ ConfigDlgProc(HWND hdlg, return FALSE; } -void test_connection(HANDLE hwnd, ConnInfo *ci, BOOL withDTC) +void test_connection(HANDLE hwnd, ConnInfo *ci) { EnvironmentClass *env = EN_Constructor(); ConnectionClass *conn = NULL; @@ -430,6 +430,11 @@ void test_connection(HANDLE hwnd, ConnInfo *ci, BOOL withDTC) #endif /* UNICODE_SUPPORT */ if (CC_connect(conn, NULL) > 0) { +#ifdef _HANDLE_ENLIST_IN_DTC_ + HRESULT res; + void *pObj = NULL; +#endif /* _HANDLE_ENLIST_IN_DTC_ */ + if (CC_get_errornumber(conn) != 0) { CC_get_error(conn, &errnum, &emsg); @@ -440,33 +445,30 @@ void test_connection(HANDLE hwnd, ConnInfo *ci, BOOL withDTC) strncpy_null(szMsg, "Connection successful", sizeof(szMsg)); } emsg = szMsg; - if (withDTC) - { - HRESULT res; - void *pObj = NULL; - pObj = CALL_GetTransactionObject(&res); - if (NULL != pObj) +#ifdef _HANDLE_ENLIST_IN_DTC_ + pObj = CALL_GetTransactionObject(&res); + if (NULL != pObj) + { + SQLRETURN ret = PGAPI_SetConnectAttr(conn, SQL_ATTR_ENLIST_IN_DTC, (SQLPOINTER) pObj, 0); + if (SQL_SUCCEEDED(ret)) { - SQLRETURN ret = PGAPI_SetConnectAttr(conn, SQL_ATTR_ENLIST_IN_DTC, (SQLPOINTER) pObj, 0); - if (SQL_SUCCEEDED(ret)) - { - PGAPI_SetConnectAttr(conn, SQL_ATTR_ENLIST_IN_DTC, SQL_DTC_DONE, 0); - snprintf(szMsg, sizeof(szMsg), "%s\nenlistment was successful\n", szMsg); - } - else - { - char *dtcerr = NULL; + PGAPI_SetConnectAttr(conn, SQL_ATTR_ENLIST_IN_DTC, SQL_DTC_DONE, 0); + snprintf(szMsg, sizeof(szMsg), "%s\nenlistment was successful\n", szMsg); + } + else + { + char *dtcerr = NULL; - CC_get_error(conn, &errnum, &dtcerr); - if (NULL != dtcerr) - snprintf(szMsg, sizeof(szMsg), "%s\nMSDTC error:%s", emsg, dtcerr); - } - CALL_ReleaseTransactionObject(pObj); + CC_get_error(conn, &errnum, &dtcerr); + if (NULL != dtcerr) + snprintf(szMsg, sizeof(szMsg), "%s\nMSDTC error:%s", emsg, dtcerr); } - else if (FAILED(res)) - snprintf(szMsg, sizeof(szMsg), "%s\nDistibuted Transaction enlistment error %x", emsg, res); + CALL_ReleaseTransactionObject(pObj); } + else if (FAILED(res)) + snprintf(szMsg, sizeof(szMsg), "%s\nDistibuted Transaction enlistment error %x", emsg, res); +#endif /* _HANDLE_ENLIST_IN_DTC_ */ } else { diff --git a/win_setup.h b/win_setup.h index c7cf8b0..1e6e844 100644 --- a/win_setup.h +++ b/win_setup.h @@ -25,6 +25,6 @@ void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg); BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg, DWORD *); BOOL INTFUNC ChangeDriverName(HWND hwnd, LPSETUPDLG lpsetupdlg, LPCSTR driver_name); -void test_connection(HANDLE hwnd, ConnInfo *ci, BOOL withDTC); +void test_connection(HANDLE hwnd, ConnInfo *ci); #endif /* _WIN_SETUP_H__ */
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: Compilation failure with nmake and MSTDC = no in HEAD
  2015-01-06 05:30 Compilation failure with nmake and MSTDC = no in HEAD Michael Paquier <michael.paquier@gmail.com>
@ 2015-01-06 09:40 ` Heikki Linnakangas <hlinnakangas@vmware.com>
  2015-01-06 11:56   ` Re: Compilation failure with nmake and MSTDC = no in HEAD Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Heikki Linnakangas @ 2015-01-06 09:40 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; pgsql-odbc

On 01/06/2015 07:30 AM, Michael Paquier wrote:
> Hi all,
>
> I noticed that the build with nmake is broken when using MSDTC = no
> becaus of e85fbb (libpq switch):
> setup.c(448) : warning C4013: 'CALL_GetTransactionObject' undefined;
> assuming extern returning int
> setup.c(448) : warning C4047: '=' : 'void *' differs in levels of
> indirection from 'int'
> setup.c(465) : warning C4013: 'CALL_ReleaseTransactionObject'
> undefined; assuming extern returning int
> Attached is a patch fixing the problem, simplifying at the same time
> test_connection in setup.c where I think the boolean flag withDtc is
> not needed.

That's not right. The withDtc parameter indicates whether the 
test_connection function is supposed to test enlistment with DTC or not. 
When you click the "Test" button on the main page on the configuration 
dialog, it's supposed to just test connecting, not DTC enlistment. When 
you click "Test" on the 3rd page in the "Datasource" settings dialog, 
then and only then it's supposed to test DTC enlistment. With your 
patch, it will always test enlistment if the driver supports it.

I put a simple #ifdef in the withDtc block in test_connection instead. 
The build works now.

- Heikki



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Compilation failure with nmake and MSTDC = no in HEAD
  2015-01-06 05:30 Compilation failure with nmake and MSTDC = no in HEAD Michael Paquier <michael.paquier@gmail.com>
  2015-01-06 09:40 ` Re: Compilation failure with nmake and MSTDC = no in HEAD Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2015-01-06 11:56   ` Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2015-01-06 11:56 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: pgsql-odbc

On Tue, Jan 6, 2015 at 6:40 PM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> I put a simple #ifdef in the withDtc block in test_connection instead. The
> build works now.
Cool. Thanks!
-- 
Michael


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2015-01-06 11:56 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 05:30 Compilation failure with nmake and MSTDC = no in HEAD Michael Paquier <michael.paquier@gmail.com>
2015-01-06 09:40 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2015-01-06 11:56   ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox