31 |
|
{$DEFINE WINDOWS} |
32 |
|
{$ENDIF} |
33 |
|
|
34 |
< |
{Create and Drop a Database} |
34 |
> |
{Test 1: Create and Drop a Database} |
35 |
|
{ |
36 |
|
This test first attempts to create a database without specifying any parameters |
37 |
|
(should fail). It then goes on to create and drop a database, print out the |
60 |
|
TTest1 = class(TFBTestBase) |
61 |
|
private |
62 |
|
procedure DoQuery(Attachment: IAttachment); |
63 |
– |
procedure WriteAttachmentInfo(Attachment: IAttachment); |
63 |
|
procedure GetFBVersion(Attachment: IAttachment); |
64 |
|
public |
65 |
|
function TestTitle: AnsiString; override; |
92 |
|
end; |
93 |
|
end; |
94 |
|
|
96 |
– |
procedure TTest1.WriteAttachmentInfo(Attachment: IAttachment); |
97 |
– |
begin |
98 |
– |
writeln(outfile,'DB Connect String = ',Attachment.GetConnectString); |
99 |
– |
writeln(outfile,'DB Charset ID = ',Attachment.GetDefaultCharSetID); |
100 |
– |
writeln(outfile,'DB SQL Dialect = ',Attachment.GetSQLDialect); |
101 |
– |
writeln(outfile,'DB Remote Protocol = ', Attachment.GetRemoteProtocol); |
102 |
– |
writeln(outfile,'DB ODS Major Version = ',Attachment.GetODSMajorVersion); |
103 |
– |
writeln(outfile,'DB ODS Minor Version = ',Attachment.GetODSMinorVersion); |
104 |
– |
writeln(outfile,'User Authentication Method = ',Attachment.GetAuthenticationMethod); |
105 |
– |
writeln(outfile,'Firebird Library Path = ',Attachment.getFirebirdAPI.GetFBLibrary.GetLibraryFilePath); |
106 |
– |
writeln(outfile,'DB Client Implementation Version = ',Attachment.getFirebirdAPI.GetImplementationVersion); |
107 |
– |
end; |
108 |
– |
|
95 |
|
procedure TTest1.GetFBVersion(Attachment: IAttachment); |
96 |
|
var Version: TStrings; |
97 |
|
i: integer; |
127 |
|
|
128 |
|
writeln(OutFile,'Creating a Database using an SQL Statement'); |
129 |
|
createSQL := Format('create database ''%s'' USER ''%s'' PASSWORD ''%s'' DEFAULT CHARACTER SET %s', |
130 |
< |
[ExtractDBName(Owner.GetNewDatabaseName), Owner.GetUserName, Owner.GetPassword, CharSet]); |
130 |
> |
[Owner.GetNewDatabaseName, Owner.GetUserName, Owner.GetPassword, CharSet]); |
131 |
|
Attachment := FirebirdAPI.CreateDatabase(createSQL,SQLDialect); |
132 |
|
WriteDBInfo(Attachment.GetDBInformation([isc_info_db_id,isc_info_db_SQL_Dialect])); |
133 |
|
WriteAttachmentInfo(Attachment); |
157 |
|
DPB.Add(isc_dpb_lc_ctype).setAsString(CharSet); |
158 |
|
DPB.Add(isc_dpb_set_db_SQL_dialect).setAsByte(SQLDialect); |
159 |
|
|
160 |
< |
Attachment := FirebirdAPI.CreateDatabase(ExtractDBName(Owner.GetNewDatabaseName),DPB); |
160 |
> |
Attachment := FirebirdAPI.CreateDatabase(Owner.GetNewDatabaseName,DPB); |
161 |
|
|
162 |
|
WriteAttachmentInfo(Attachment); |
163 |
|
|
169 |
|
|
170 |
|
PrintDPB(DPB); |
171 |
|
writeln(OutFile,'Creating a Database with a DPD'); |
172 |
< |
Attachment := FirebirdAPI.CreateDatabase(ExtractDBName(Owner.GetNewDatabaseName),DPB); |
172 |
> |
Attachment := FirebirdAPI.CreateDatabase(Owner.GetNewDatabaseName,DPB); |
173 |
|
if Attachment = nil then |
174 |
|
begin |
175 |
|
writeln(OutFile,'Create Database Failed'); |
190 |
|
FBLibrary := LoadFBLibrary(libpath); |
191 |
|
|
192 |
|
writeln(OutFile,'Creating a Database with a DPD using Firebird Library in ',libpath); |
193 |
< |
Attachment := FBLibrary.GetFirebirdAPI.CreateDatabase(ExtractDBName(Owner.GetNewDatabaseName),DPB); |
193 |
> |
Attachment := FBLibrary.GetFirebirdAPI.CreateDatabase(Owner.GetNewDatabaseName,DPB); |
194 |
|
if Attachment = nil then |
195 |
|
begin |
196 |
|
writeln(OutFile,'Create Database Failed'); |