17 |
|
{$IFDEF FPC} |
18 |
|
{$mode delphi} |
19 |
|
{$codepage utf8} |
20 |
+ |
{$define HASREQEX} |
21 |
|
{$ENDIF} |
22 |
|
|
23 |
|
interface |
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 |
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; |
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); |