ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/testsuite/Test1.pas
(Generate patch)

Comparing ibx/trunk/fbintf/testsuite/Test1.pas (file contents):
Revision 47 by tony, Mon Jan 9 15:31:51 2017 UTC vs.
Revision 119 by tony, Mon Jan 22 13:58:18 2018 UTC

# Line 1 | Line 1
1   unit Test1;
2 + {$IFDEF MSWINDOWS}
3 + {$DEFINE WINDOWS}
4 + {$IF defined(CompilerVersion) and (CompilerVersion >= 28)}
5 + {Delphi XE7 onwards}}
6 + {$define HASREQEX}
7 + {$IFEND}
8 + {$ENDIF}
9  
10   {Create and Drop a Database}
11   {
# Line 11 | Line 18 | unit Test1;
18   A basic query is performed and finally the database dropped.
19   }
20  
21 < {$mode objfpc}{$H+}
21 > {$IFDEF FPC}
22 > {$mode delphi}
23   {$codepage utf8}
24 + {$define HASREQEX}
25 + {$ENDIF}
26  
27   interface
28  
# Line 27 | Line 37 | type
37    private
38      procedure DoQuery(Attachment: IAttachment);
39    public
40 <    function TestTitle: string; override;
41 <    procedure RunTest(CharSet: string; SQLDialect: integer); override;
40 >    function TestTitle: AnsiString; override;
41 >    procedure RunTest(CharSet: AnsiString; SQLDialect: integer); override;
42    end;
43  
44   implementation
# Line 57 | Line 67 | begin
67      end;
68   end;
69  
70 < function TTest1.TestTitle: string;
70 > function TTest1.TestTitle: AnsiString;
71   begin
72    Result := 'Test 1: Create and Drop a Database';
73   end;
74  
75 < procedure TTest1.RunTest(CharSet: string; SQLDialect: integer);
75 > procedure TTest1.RunTest(CharSet: AnsiString; SQLDialect: integer);
76   var DPB: IDPB;
77      Attachment: IAttachment;
78 <    createSQL: string;
78 >    createSQL: AnsiString;
79   begin
80    writeln(OutFile,'Creating a Database with empty parameters');
81    Attachment := FirebirdAPI.CreateDatabase('',nil,false);
# Line 75 | Line 85 | begin
85      Attachment.DropDatabase;
86  
87    writeln(OutFile,'Creating a Database using an SQL Statement');
88 <  createSQL := Format('CREATE DATABASE ''%s'' USER ''%s'' PASSWORD ''%s'' DEFAULT CHARACTER SET %s',
88 >  createSQL := Format('create database ''%s'' USER ''%s'' PASSWORD ''%s'' DEFAULT CHARACTER SET %s',
89                        [Owner.GetNewDatabaseName, Owner.GetUserName, Owner.GetPassword, CharSet]);
90    Attachment := FirebirdAPI.CreateDatabase(createSQL,SQLDialect);
91    WriteDBInfo(Attachment.GetDBInformation([isc_info_db_id,isc_info_db_SQL_Dialect]));
92 +  writeln(outfile,'DB Connect String = ',Attachment.GetConnectString);
93 +  writeln(outfile,'DB Charset ID = ',Attachment.GetDefaultCharSetID);
94 +  writeln(outfile,'DB SQL Dialect = ',Attachment.GetSQLDialect);
95 +  writeln(outfile,'DB Remote Protocol = ', Attachment.GetRemoteProtocol);
96 +  writeln(outfile,'DB ODS Major Version = ',Attachment.GetODSMajorVersion);
97 +  writeln(outfile,'DB ODS Minor Version = ',Attachment.GetODSMinorVersion);
98 +  PrintDPB(Attachment.getDPB);
99 +
100 +  {$IFDEF HASREQEX}
101 +  {Demonstrate reconnect when database created with SQL Statement}
102 +  try
103 +    Attachment.Disconnect;
104 +    Attachment.Connect;
105 +  except on E:Exception do
106 +    writeln(OutFile,'Error reconnecting to Database: ',E.Message);
107 +  end;
108 +  {$ENDIF}
109  
110    writeln(OutFile,'Dropping Database');
111    if Attachment <> nil then
# Line 93 | Line 120 | begin
120  
121    Attachment := FirebirdAPI.CreateDatabase(Owner.GetNewDatabaseName,DPB);
122  
123 +  writeln(outfile,'DB Connect String = ',Attachment.GetConnectString);
124 +  writeln(outfile,'DB Charset ID = ',Attachment.GetDefaultCharSetID);
125 +  writeln(outfile,'DB SQL Dialect = ',Attachment.GetSQLDialect);
126 +  writeln(outfile,'DB Remote Protocol = ', Attachment.GetRemoteProtocol);
127 +  writeln(outfile,'DB ODS Major Version = ',Attachment.GetODSMajorVersion);
128 +  writeln(outfile,'DB ODS Minor Version = ',Attachment.GetODSMinorVersion);
129 +
130    writeln(OutFile,'Dropping Database');
131    if Attachment <> nil then
132      Attachment.DropDatabase;
# Line 108 | Line 142 | begin
142      Exit;
143    end;
144    WriteDBInfo(Attachment.GetDBInformation([isc_info_db_id,isc_info_ods_version,isc_info_ods_minor_version]));
145 +  writeln(outfile,'DB Connect String = ',Attachment.GetConnectString);
146 +  writeln(outfile,'DB Charset ID = ',Attachment.GetDefaultCharSetID);
147 +  writeln(outfile,'DB SQL Dialect = ',Attachment.GetSQLDialect);
148 +  writeln(outfile,'DB Remote Protocol = ', Attachment.GetRemoteProtocol);
149 +  writeln(outfile,'DB ODS Major Version = ',Attachment.GetODSMajorVersion);
150 +  writeln(outfile,'DB ODS Minor Version = ',Attachment.GetODSMinorVersion);
151  
152    {Querying Database}
153    DoQuery(Attachment);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines