28 |
|
|
29 |
|
unit IBDatabaseEdit; |
30 |
|
|
31 |
+ |
{$MODE Delphi} |
32 |
+ |
|
33 |
+ |
{$A+} (* Aligned records: On *) |
34 |
+ |
{$B-} (* Short circuit boolean expressions: Off *) |
35 |
+ |
{$G+} (* Imported data: On *) |
36 |
+ |
{$H+} (* Huge Strings: On *) |
37 |
+ |
{$J-} (* Modification of Typed Constants: Off *) |
38 |
+ |
{$M+} (* Generate run-time type information: On *) |
39 |
+ |
{$O+} (* Optimization: On *) |
40 |
+ |
{$Q-} (* Overflow checks: Off *) |
41 |
+ |
{$R-} (* Range checks: Off *) |
42 |
+ |
{$T+} (* Typed address: On *) |
43 |
+ |
{$U+} (* Pentim-safe FDIVs: On *) |
44 |
+ |
{$W-} (* Always generate stack frames: Off *) |
45 |
+ |
{$X+} (* Extended syntax: On *) |
46 |
+ |
{$Z1} (* Minimum Enumeration Size: 1 Byte *) |
47 |
+ |
|
48 |
+ |
|
49 |
|
interface |
50 |
|
|
51 |
|
uses |
52 |
< |
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, |
53 |
< |
StdCtrls, ExtCtrls, IBDatabase, IB, IBXConst; |
52 |
> |
{Windows,} Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, |
53 |
> |
StdCtrls, ExtCtrls, IBDataBase, IB, IBXConst, LResources; |
54 |
|
|
55 |
|
type |
56 |
+ |
|
57 |
+ |
{ TIBDatabaseEditForm } |
58 |
+ |
|
59 |
|
TIBDatabaseEditForm = class(TForm) |
60 |
|
Panel1: TPanel; |
61 |
|
DatabaseName: TEdit; |
73 |
|
DatabaseParams: TMemo; |
74 |
|
OKBtn: TButton; |
75 |
|
CancelBtn: TButton; |
55 |
– |
HelpBtn: TButton; |
76 |
|
Label5: TLabel; |
77 |
|
LoginPrompt: TCheckBox; |
78 |
|
Label6: TLabel; |
111 |
|
|
112 |
|
implementation |
113 |
|
|
114 |
< |
{$R *.DFM} |
114 |
> |
{$R *.lfm} |
115 |
|
|
116 |
< |
uses LibHelp, TypInfo; |
116 |
> |
uses TypInfo; |
117 |
|
|
118 |
|
function EditIBDatabase(ADatabase: TIBDatabase): Boolean; |
119 |
|
begin |
149 |
|
found := False; |
150 |
|
if Trim(Value) <> '' then |
151 |
|
begin |
152 |
+ |
DatabaseParams.Lines.NameValueSeparator := '='; |
153 |
|
for i := 0 to DatabaseParams.Lines.Count - 1 do |
154 |
|
begin |
155 |
|
if (Pos(Name, LowerCase(DatabaseParams.Lines.Names[i])) = 1) then {mbcs ok} |
232 |
|
end; |
233 |
|
begin |
234 |
|
DecomposeDatabaseName; |
235 |
< |
DatabaseParams.Lines := Database.Params; |
235 |
> |
if Trim(Database.Params.Text) = '' then |
236 |
> |
DatabaseParams.Clear |
237 |
> |
else |
238 |
> |
DatabaseParams.Lines.Assign(Database.Params); |
239 |
|
LoginPrompt.Checked := Database.LoginPrompt; |
240 |
|
UserName.Text := GetParam('user_name'); |
241 |
|
Password.Text := GetParam('password'); |
268 |
|
Label8.Enabled := True; |
269 |
|
Protocol.Enabled := True; |
270 |
|
ServerName.Enabled := True; |
271 |
+ |
if Protocol.Text = '' then |
272 |
+ |
Protocol.Text := 'TCP'; |
273 |
|
end; |
274 |
|
|
275 |
|
procedure TIBDatabaseEditForm.BrowseClick(Sender: TObject); |
308 |
|
|
309 |
|
procedure TIBDatabaseEditForm.FormCreate(Sender: TObject); |
310 |
|
begin |
311 |
< |
HelpContext := hcDIBDataBaseEdit; |
311 |
> |
// HelpContext := hcDIBDataBaseEdit; |
312 |
|
end; |
313 |
|
|
314 |
|
procedure TIBDatabaseEditForm.HelpBtnClick(Sender: TObject); |
356 |
|
end; |
357 |
|
tempDB.Params.Assign(DatabaseParams.Lines); |
358 |
|
tempDB.LoginPrompt := LoginPrompt.Checked; |
359 |
< |
tempDB.Connected := true; |
360 |
< |
ShowMessage('Successful Connection'); |
359 |
> |
try |
360 |
> |
tempDB.Connected := true; |
361 |
> |
ShowMessage('Successful Connection'); |
362 |
> |
except on E: Exception do |
363 |
> |
ShowMessage(E.Message) |
364 |
> |
end; |
365 |
|
finally |
366 |
|
tempDB.Free; |
367 |
|
Test.Enabled := true; |
368 |
|
end; |
369 |
|
end; |
370 |
|
|
371 |
+ |
|
372 |
|
end. |