BrianV
2008-07-27 04:02:11 UTC
I have a TSQLQuery component that I use to do simple queries, called
GenericQuery. I use it like this:
vector<MyType*> retVal;
GenericQuery->SQL->Clear();
GenericQuery->SQL->Add("SELECT * FROM table_1 WHERE HIDDEN = 0");
GenericQuery->Open();
while (!GenericQuery->Eof)
{
TField* f1F = GenericQuery->Fields->FieldByName("field_1");
TField* f2F = GenericQuery->Fields->FieldByName("field_2");
TField* f3F = GenericQuery->Fields->FieldByName("field_3");
TField* hidF = GenericQuery->Fields->FieldByName("hidden");
retVal.push_back(new MyType(f1F,f2F,f3F,hidF));
GenericQuery->Next();
}
GenericQuery->Close();
return retVal;
If I call this method the first time, it's fine. If I call it twice in a
row, it's fine. If I call another TSQLQuery on the same connection after
calling this method, and then go back and call this method, I get an access
violation. After the access violation, it works fine again. The violation
occurs at the line 'GenericQuery->SQL->Clear();'. The stack trace looks
like this:
:7c812a5b kernel32.RaiseException + 0x52
:008e3f0a ___raiseDebuggerException + 0x1A
:008ef598 ; ____ExceptionHandler
:008e32ed __ExceptionHandler + 0x1E
:7c90378b ntdll.RtlConvertUlongToLargeInteger + 0x46
:7c90eafa ntdll.KiUserExceptionDispatcher + 0xe
:006FA300 Sqlexpr::TSQLQuery::QueryChanged(Self=????, Sender=????)
:005EF680 Widestrings::TWideStringList::Changed(Self=????)
:004E22D2 TMyTypeOfForm::TMyTypeOfForm(this=:01416E20, Owner=:014C9650)
If I trace way down into the DBX code, the exception ends up being raised on
this line in SqlExpr.pas
if (Assigned(Connection) and (Connection.MetaData is
TDBXDatabaseMetaDataEx)) then
Has anyone seen something like this? Something I'm doing wrong? Known bug?
Thanks for any insight. If it matters I'm using an upscene driver and
Firebird 2.0 database.
GenericQuery. I use it like this:
vector<MyType*> retVal;
GenericQuery->SQL->Clear();
GenericQuery->SQL->Add("SELECT * FROM table_1 WHERE HIDDEN = 0");
GenericQuery->Open();
while (!GenericQuery->Eof)
{
TField* f1F = GenericQuery->Fields->FieldByName("field_1");
TField* f2F = GenericQuery->Fields->FieldByName("field_2");
TField* f3F = GenericQuery->Fields->FieldByName("field_3");
TField* hidF = GenericQuery->Fields->FieldByName("hidden");
retVal.push_back(new MyType(f1F,f2F,f3F,hidF));
GenericQuery->Next();
}
GenericQuery->Close();
return retVal;
If I call this method the first time, it's fine. If I call it twice in a
row, it's fine. If I call another TSQLQuery on the same connection after
calling this method, and then go back and call this method, I get an access
violation. After the access violation, it works fine again. The violation
occurs at the line 'GenericQuery->SQL->Clear();'. The stack trace looks
like this:
:7c812a5b kernel32.RaiseException + 0x52
:008e3f0a ___raiseDebuggerException + 0x1A
:008ef598 ; ____ExceptionHandler
:008e32ed __ExceptionHandler + 0x1E
:7c90378b ntdll.RtlConvertUlongToLargeInteger + 0x46
:7c90eafa ntdll.KiUserExceptionDispatcher + 0xe
:006FA300 Sqlexpr::TSQLQuery::QueryChanged(Self=????, Sender=????)
:005EF680 Widestrings::TWideStringList::Changed(Self=????)
:004E22D2 TMyTypeOfForm::TMyTypeOfForm(this=:01416E20, Owner=:014C9650)
If I trace way down into the DBX code, the exception ends up being raised on
this line in SqlExpr.pas
if (Assigned(Connection) and (Connection.MetaData is
TDBXDatabaseMetaDataEx)) then
Has anyone seen something like this? Something I'm doing wrong? Known bug?
Thanks for any insight. If it matters I'm using an upscene driver and
Firebird 2.0 database.