[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql-plusplus
Subject: Access Violation without crash
From: Patrice BEAUJOLIN <pbeaujolin () alex ! fr>
Date: 2001-06-26 12:57:21
[Download RAW message or body]
Hi all !
I've got a strange behaviour when running the simpliest sample program
in debug (step by step) mode
System:
Win NT4 sp5
MSVC++ 6.0 (not patched)
mysql++ lib recompiled in multithread mode (same behaviour with original lib)
When I don't make any reference to the 'row' variable everything works fine.
As soon as I attempt an access (i.e. adding dateTime = row[1]; ), I've got an
0xC0000005: Access Violation error message on the 'try' instruction (in the \
disassembly code, just after line 23) but the progrom does not crash. Resuming from \
this error take up to 30 seconds but is OK.
When Executing the program (no step by step), everything is just fine.
Is this behaviour a normal one, or what am I doing wrong?
Any suggestion would be greatly appreciated.
Thanks for your attention
Here is the code :
#include "windows.h"
#pragma warning(disable: 4786)
#pragma warning(disable: 4800)
#define MYSQL_NO_SHORT_NAMES
#include "sqlplus.hh"
using namespace std;
int main(int argc, char* argv[])
{
try { // its in one big try block
MysqlRes::iterator i;
Row row;
MysqlRes sqlResult;
MysqlDateTime dateTime;
MysqlConnection con(mysql_use_exceptions);
con.connect(DB_NAME, DB_HOST, DB_USER, DB_PWD);
MysqlQuery query = con.query();
query << "select * from action";
sqlResult = query.store();
for (i = sqlResult.begin(); i != sqlResult.end(); i++) {
row = *i;
dateTime = row[1];
}
return 0;
} catch (MysqlBadQuery er) { // handle any connection or
// query errors that may come up
printf("Query Error\n");
return -1;
} catch (MysqlBadConversion er) { // handle bad conversions
printf("Conversion Error\n");
return -2;
}
}
Here is the disassembly code part:
20: int main(int argc, char* argv[])
21: {
00401FC0 push ebp
00401FC1 mov ebp,esp
00401FC3 push 0FFh
00401FC5 push offset __ehhandler$_main (00463c42)
00401FCA mov eax,fs:[00000000]
00401FD0 push eax
00401FD1 mov dword ptr fs:[0],esp
00401FD8 push ecx
00401FD9 sub esp,570h
00401FDF push ebx
00401FE0 push esi
00401FE1 push edi
00401FE2 mov dword ptr [ebp-10h],esp
00401FE5 lea edi,[ebp-580h]
00401FEB mov ecx,15Ch
00401FF0 mov eax,0CCCCCCCCh
00401FF5 rep stos dword ptr [edi]
22:
23: try { // its in one big try block
00401FF7 mov dword ptr [ebp-4],0 \
<------------------- Here is the access violation 24:
25: char c;
26: MysqlRes::iterator i;
00401FFE lea ecx,[i]
00402001 call \
@ILT+1525(subscript_iterator<const_subscript_container<MysqlRes,MysqlRow,MysqlRow \
const
Best regards,
Patrice BEAUJOLIN
Software Engineer
----------------------
Alex Temex Multimedia S.A.
4 Bis, Avenue du pré de Challes
74940 Annecy le vieux - FRANCE
Phone : +33 (0) 4 50 64 08 97
Fax : +33 (0) 4 50 64 09 02
email : pbeaujolin@alex.fr
http://www.alex.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic