|
Home > Archive > Microsoft SQL Server forum > July 2005 > Problem with SQLFreeStmt
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problem with SQLFreeStmt
|
|
|
| Hi,
I have some C++ code which does the following
retcode = SQLFreeStmt(hStmt,SQ
L_UNBIND);
retcode = SQLFreeStmt(hStmt,SQ
L_RESET_PA_RAMS);
retcode = SQLFreeStmt(hStmt,SQ
L_CLOSE);
But sometimes it cores in the third statement.
I tried using "SQLCloseCursor (hStmt)" in its place but it also core dumped
sometimes.
Following is the stack
signal SEGV (no mapping at the fault address) in
Or8Statement::setToA
llocatedSt_e at 0xfd1be710
0xfd1be710: setToAllocatedState+
0x0368: ld [%o0 + 0xc], %g2
SQLCloseCursor(0x311
4d68, 0xffffffff, 0x2fb58d8, 0x4e3f24, 0x45c0b4, 0x2)
BaseStatement::SQLCl
oseCursor(_0x303c8b0
, 0xffffffff, 0x0, 0xc, 0x5c,
0xff1f1d14)
BaseStatement::reset
ToAllocate_d(0x303c8
b0, 0x0, 0x0, 0x8, 0x8, 0x8)
Or8Statement::setToA
llocatedSt_ate(0x303
c8b0, 0x28, 0x8, 0x0, 0x0, 0x0)
The contents of hStmt were same in all three statements at the time of core.
Menas the hStmt handle was still valid because just before the third
statement i tried to get the cursor name from the handle, But then also it
cored after printing the cursor name properly.
I suspect that the data structure to which hStmt points is getting corrupt.
But i don't know how. can it be because of some corruption in my code. I
also tried to move the location on hStmt in my object (as its a member
variable, So it will change its offset inside the object) but then also it
cored at same place.
Any help is greatly appreciated.
| |
| Erland Sommarskog 2005-07-02, 11:23 am |
| Sandy (a@a.com) writes:
> I suspect that the data structure to which hStmt points is getting
> corrupt. But i don't know how. can it be because of some corruption in
> my code.
I have not worked with the ODBC API, but my experience from working
with a module that uses both the OLE DB API and the Perl API (it's
to be called from Perl) is that when my module crashes, it's usually
my fault. One bug was really tricky was some piece of code where I
allocated one byte too few. Most of the time the code worked fine, but
occasionally I would overwrite something when I wrote to that byte.
But of course nothing crashed at that point, but that happened much
later.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
|
|
|
|
|