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 120 by tony, Mon Jan 22 13:58:20 2018 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines