Subject | Upgrade D2007 to XE2, IBO 4.8 to 5.0 beta and Threaded Query causing AV? |
---|---|
Author | Chuck Belanger |
Post date | 2012-08-18T09:39:31Z |
Hello:
Recently, I upgraded from Delphi 2007 to XE2. As part of that upgrade, I
am using IBO 5+ beta.
I have a section of my program which checks a DB on the internet which I
do threaded. The rest of the application uses a local Firebird database.
Everything was working fine before the upgrade, but now I get an AV on
the OPEN in the following code for a routine called within the thread,
GETUSERID().
I pass a connection that is created at the top of the thread. It has a
IB_Session associated with that.
Below is the madExcept error report, partial.
Any ideas on what is going on? I suspect that I may not have set this up
right to begin with, but the newer IBO is now catching it.
Thank you for any help you can give,
Chuck Belanger
Here is that code:
FUNCTION TGNNDataModule.GetUserID(LocalConnection: TIB_Connection) :
INTEGER;
var
QRY: TIB_Query;
BEGIN
Result := -1;
Qry := TIB_Query.Create(nil);
try
WITH QRY DO
BEGIN
IB_Connection := LocalConnection;
SQL.Clear;
//there are two records in TreeDefaults and if User_id is present,
it will
//be in both records
SQL.Add('Select First 1 USER_ID from Tree_Defaults');
* AV here ==> Open;*
IF FieldByName('user_id').IsNotNull THEN
BEGIN Result := FieldByName('user_id').asInteger END;
Qry.Close;
END;
finally
FreeAndNil(qry);
end;
END;
mad Except report
operating system : Windows 7 x64 Service Pack 1 build 7601
system language : English
system up time : 4 hours 11 minutes
program up time : 24 seconds
processors : 2x Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz
physical memory : 1611/4094 MB (free/total)
free disk space : (C:) 195.60 GB (D:) 214.15 GB
display mode : 1680x1050, 32 bit
process id : $7f8
allocated memory : 104.66 MB
executable : ProfViewer.exe
exec. date/time : 2012-08-18 02:17
version : 3.0.1.3
compiled with : Delphi XE2
madExcept version : 4.0.2
callstack crc : $604554bb, $32c32c95, $ff5928ee
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 0072968E in module
'ProfViewer.exe'. Read of address 00000174.
thread $ad8 (TBMDExecuteThread): <priority:-1>
0072968e +012 ProfViewer.exe IB_Components 23584 +1 PrepareOutDa
00729876 +0ba ProfViewer.exe IB_Components 23617 +9
TIB_Statement.API_Prepare
00726d82 +216 ProfViewer.exe IB_Components 22411 +39
TIB_Statement.SysExecPrepare
00733cac +008 ProfViewer.exe IB_Components 27873 +1
TIB_Dataset.SysExecPrepare
0072696f +027 ProfViewer.exe IB_Components 22302 +3 DoExecPrepare
00726a61 +08d ProfViewer.exe IB_Components 22336 +22
TIB_Statement.SysPrepare
00732c26 +08a ProfViewer.exe IB_Components 27567 +11
TIB_Dataset.SysPrepare
007258dc +024 ProfViewer.exe IB_Components 21880 +3
TIB_Statement.Prepare
00f9fe8a +072 ProfViewer.exe GNNDataMod 598 +48 <==OPEN statement
TGNNDataModule.GetUserID
00f9e9ff +07b ProfViewer.exe GNNDataMod 351 +12
TGNNDataModule.AddPractitionersToGNN
00fbbddc +214 ProfViewer.exe GNNDataMod 8752 +102 DoGNNInitialCheck
00f9ff93 +003 ProfViewer.exe GNNDataMod 621 +1
TGNNDataModule.BMDThreadInitialGNNChecksExecute
00e0dd90 +018 ProfViewer.exe BMDThread 402 +2 TBMDThread.Execute
00e0db7d +005 ProfViewer.exe BMDThread 315 +0
TBMDExecuteThread.Execute
[Non-text portions of this message have been removed]
Recently, I upgraded from Delphi 2007 to XE2. As part of that upgrade, I
am using IBO 5+ beta.
I have a section of my program which checks a DB on the internet which I
do threaded. The rest of the application uses a local Firebird database.
Everything was working fine before the upgrade, but now I get an AV on
the OPEN in the following code for a routine called within the thread,
GETUSERID().
I pass a connection that is created at the top of the thread. It has a
IB_Session associated with that.
Below is the madExcept error report, partial.
Any ideas on what is going on? I suspect that I may not have set this up
right to begin with, but the newer IBO is now catching it.
Thank you for any help you can give,
Chuck Belanger
Here is that code:
FUNCTION TGNNDataModule.GetUserID(LocalConnection: TIB_Connection) :
INTEGER;
var
QRY: TIB_Query;
BEGIN
Result := -1;
Qry := TIB_Query.Create(nil);
try
WITH QRY DO
BEGIN
IB_Connection := LocalConnection;
SQL.Clear;
//there are two records in TreeDefaults and if User_id is present,
it will
//be in both records
SQL.Add('Select First 1 USER_ID from Tree_Defaults');
* AV here ==> Open;*
IF FieldByName('user_id').IsNotNull THEN
BEGIN Result := FieldByName('user_id').asInteger END;
Qry.Close;
END;
finally
FreeAndNil(qry);
end;
END;
mad Except report
operating system : Windows 7 x64 Service Pack 1 build 7601
system language : English
system up time : 4 hours 11 minutes
program up time : 24 seconds
processors : 2x Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz
physical memory : 1611/4094 MB (free/total)
free disk space : (C:) 195.60 GB (D:) 214.15 GB
display mode : 1680x1050, 32 bit
process id : $7f8
allocated memory : 104.66 MB
executable : ProfViewer.exe
exec. date/time : 2012-08-18 02:17
version : 3.0.1.3
compiled with : Delphi XE2
madExcept version : 4.0.2
callstack crc : $604554bb, $32c32c95, $ff5928ee
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 0072968E in module
'ProfViewer.exe'. Read of address 00000174.
thread $ad8 (TBMDExecuteThread): <priority:-1>
0072968e +012 ProfViewer.exe IB_Components 23584 +1 PrepareOutDa
00729876 +0ba ProfViewer.exe IB_Components 23617 +9
TIB_Statement.API_Prepare
00726d82 +216 ProfViewer.exe IB_Components 22411 +39
TIB_Statement.SysExecPrepare
00733cac +008 ProfViewer.exe IB_Components 27873 +1
TIB_Dataset.SysExecPrepare
0072696f +027 ProfViewer.exe IB_Components 22302 +3 DoExecPrepare
00726a61 +08d ProfViewer.exe IB_Components 22336 +22
TIB_Statement.SysPrepare
00732c26 +08a ProfViewer.exe IB_Components 27567 +11
TIB_Dataset.SysPrepare
007258dc +024 ProfViewer.exe IB_Components 21880 +3
TIB_Statement.Prepare
00f9fe8a +072 ProfViewer.exe GNNDataMod 598 +48 <==OPEN statement
TGNNDataModule.GetUserID
00f9e9ff +07b ProfViewer.exe GNNDataMod 351 +12
TGNNDataModule.AddPractitionersToGNN
00fbbddc +214 ProfViewer.exe GNNDataMod 8752 +102 DoGNNInitialCheck
00f9ff93 +003 ProfViewer.exe GNNDataMod 621 +1
TGNNDataModule.BMDThreadInitialGNNChecksExecute
00e0dd90 +018 ProfViewer.exe BMDThread 402 +2 TBMDThread.Execute
00e0db7d +005 ProfViewer.exe BMDThread 315 +0
TBMDExecuteThread.Execute
[Non-text portions of this message have been removed]