Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iODBC Mac EXC_BAD_ACCESS #23

Closed
cybearinsight opened this issue Jun 29, 2017 · 6 comments
Closed

iODBC Mac EXC_BAD_ACCESS #23

cybearinsight opened this issue Jun 29, 2017 · 6 comments

Comments

@cybearinsight
Copy link

I have started to use iODBC on mac and when I connect to a Datasource name that does not exist I get an error, that is fine, but when I try to get the diagnostic information the iODBC Driver manager crashes:

I am calling the SQLGetDiagField to get the number of diagnostic record.

From Debugger:
(lldb) bt

  • thread Can't built on OSX #1: tid = 0x1835025, 0x0000000101c1a56e iODBCSQLGetDiagField_Internal + 2766, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x538) frame #0: 0x0000000101c1a56e iODBCSQLGetDiagField_Internal + 2766
    frame Can't built on OSX #1: 0x0000000101c1aeb3 iODBC`SQLGetDiagField + 163
    • frame Severe warnings may exhibit random runtime failures #2: 0x0000000101bd0b1a cxdya63u64i.dylibAddDiagRecord(pObj=0x000000010070f5d0, no=2, rowNo=0) + 442 at sqodbc.c:276 frame #3: 0x0000000101bd1719 cxdya63u64i.dylibCheckErrorRow(pObj=0x000000010070f5d0, lErrorCode=-1, rowNo=0) + 105 at sqodbc.c:374

Frame 2 where I call SQLGetDiagField:

276 lErrorCode=SQLGetDiagField(handletype,handle,0,SQL_DIAG_NUMBER,&diagCount,sizeof(diagCount),&ressize);
277 // LOG2File("AddDiagRecord1 %d %d %d",lErrorCode,diagCount,ressize);
278 if ( lErrorCode != noErr || diagCount==0)
279 {
280 // SQLGetDiagField failed try to get error info using SQLError through function ODBCErrorText
281 PAA pRes,pAA;
282 UI4 shape;
283
284 SI4 Nativ,ErrLen=0;
285 CH1 ErrText[MaxErrorLen];
(lldb) fr v
(POBJ) pObj = 0x000000010070f5d0
(SI4) no = 2
(SI4) rowNo = 0
(SI4) lErrorCode = 0
(SI4) lE = 0
(SQLINTEGER) diagCount = 0
(SQLINTEGER) i = 0
(long) errorRow = 0
(SQLSMALLINT) ressize = 0
(SQLHANDLE) handle = 0x000000010180f430
(SQLSMALLINT) handletype = 2

The code to extract diagnostic information seems to would with other Datasource managers, Native Windows, unixODBC 2.2 , unixODBC 2.3 and DataDirect 7.1.6 on AIX

@cybearinsight
Copy link
Author

I have a fix for the issue but I am not able to push it back to the repository.

@smalinin
Copy link
Collaborator

smalinin commented Jul 5, 2017

You could create patch/diff and put it here in message, I will recheck it and apply to source code

@cybearinsight
Copy link
Author

Like this:
098ccf83fca73f074dfd27764f9835612b691db6
iodbc/herr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iodbc/herr.c b/iodbc/herr.c
index a721bf6..17f8620 100644
--- a/iodbc/herr.c
+++ b/iodbc/herr.c
@@ -1370,7 +1370,7 @@ SQLGetDiagField_Internal (
{
(*(SQLINTEGER ) pDiagInfoPtr) = 0;
/
get the number from the driver */

  •     if (con)
    
  •     if (con  && con->henv)
      {
                 CALL_UDRIVER(con, Handle, retcode, hproc, unicode_driver, en_GetDiagField,
                   (nHandleType, dhandle, 0, nDiagIdentifier, 
    

Issue23diff.txt

@cybearinsight
Copy link
Author

cybearinsight commented Jul 5, 2017 via email

@smalinin
Copy link
Collaborator

smalinin commented Jul 5, 2017

Ok, thanks, it will be added.

@smalinin smalinin closed this as completed Jul 5, 2017
@cybearinsight
Copy link
Author

cybearinsight commented Aug 23, 2017 via email

pkleef pushed a commit that referenced this issue Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants