1 |
|
unit Test3; |
2 |
+ |
{$IFDEF MSWINDOWS} |
3 |
+ |
{$DEFINE WINDOWS} |
4 |
+ |
{$ENDIF} |
5 |
|
|
6 |
< |
{$mode objfpc}{$H+} |
6 |
> |
{$IFDEF FPC} |
7 |
> |
{$mode delphi} |
8 |
|
{$codepage utf8} |
9 |
+ |
{$ENDIF} |
10 |
|
|
11 |
|
{ Test 3: ad hoc queries} |
12 |
|
|
39 |
|
private |
40 |
|
procedure DoQuery(Attachment: IAttachment); |
41 |
|
public |
42 |
< |
function TestTitle: string; override; |
43 |
< |
procedure RunTest(CharSet: string; SQLDialect: integer); override; |
42 |
> |
function TestTitle: AnsiString; override; |
43 |
> |
procedure RunTest(CharSet: AnsiString; SQLDialect: integer); override; |
44 |
|
end; |
45 |
|
|
46 |
|
|
74 |
|
ResultSet := Attachment.OpenCursorAtStart('Select count(*) from EMPLOYEE'); |
75 |
|
writeln(OutFile,'Employee Count = ',ResultSet[0].AsInteger); |
76 |
|
|
77 |
+ |
{$IFNDEF FPC} |
78 |
+ |
Transaction.Rollback; {Delphi does not dispose of interfaces until the end of the function |
79 |
+ |
so we need to explicitly rollback here. FPC will dispose of the |
80 |
+ |
interface as soon as it is overwritten - hence this is not needed.} |
81 |
+ |
{$ENDIF} |
82 |
|
Transaction := Attachment.StartTransaction([isc_tpb_write,isc_tpb_nowait,isc_tpb_concurrency],taRollback); |
83 |
|
Statement := Attachment.PrepareWithNamedParameters(Transaction,'Execute Procedure DELETE_EMPLOYEE :EMP_NO',3); |
84 |
|
Statement.GetSQLParams.ByName('EMP_NO').AsInteger := 8; |
103 |
|
|
104 |
|
end; |
105 |
|
|
106 |
< |
function TTest3.TestTitle: string; |
106 |
> |
function TTest3.TestTitle: AnsiString; |
107 |
|
begin |
108 |
|
Result := 'Test 3: ad hoc queries'; |
109 |
|
end; |
110 |
|
|
111 |
< |
procedure TTest3.RunTest(CharSet: string; SQLDialect: integer); |
111 |
> |
procedure TTest3.RunTest(CharSet: AnsiString; SQLDialect: integer); |
112 |
|
var Attachment: IAttachment; |
113 |
|
DPB: IDPB; |
114 |
|
begin |