28 |
|
|
29 |
|
unit IBDatabaseEdit; |
30 |
|
|
31 |
< |
{$MODE Delphi} {$H-} |
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 |
|
|
73 |
|
DatabaseParams: TMemo; |
74 |
|
OKBtn: TButton; |
75 |
|
CancelBtn: TButton; |
60 |
– |
HelpBtn: TButton; |
76 |
|
Label5: TLabel; |
77 |
|
LoginPrompt: TCheckBox; |
78 |
|
Label6: TLabel; |
82 |
|
Label7: TLabel; |
83 |
|
Label8: TLabel; |
84 |
|
Test: TButton; |
70 |
– |
procedure CharacterSetCloseUp(Sender: TObject); |
85 |
|
procedure RemoteRbtnClick(Sender: TObject); |
86 |
|
procedure BrowseClick(Sender: TObject); |
87 |
|
procedure LocalRbtnClick(Sender: TObject); |
111 |
|
|
112 |
|
implementation |
113 |
|
|
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 |
< |
end; |
272 |
< |
|
254 |
< |
procedure TIBDatabaseEditForm.CharacterSetCloseUp(Sender: TObject); |
255 |
< |
begin |
256 |
< |
if (CharacterSet.Text <> 'None') then {do not localize} |
257 |
< |
AddParam('lc_ctype', CharacterSet.Text) |
258 |
< |
else |
259 |
< |
DeleteParam('lc_ctype'); |
260 |
< |
|
271 |
> |
if Protocol.Text = '' then |
272 |
> |
Protocol.Text := 'TCP'; |
273 |
|
end; |
274 |
|
|
275 |
|
procedure TIBDatabaseEditForm.BrowseClick(Sender: TObject); |
333 |
|
|
334 |
|
procedure TIBDatabaseEditForm.CharacterSetChange(Sender: TObject); |
335 |
|
begin |
324 |
– |
ShowMessage(CharacterSet.Text); |
336 |
|
if (CharacterSet.Text <> 'None') then {do not localize} |
337 |
|
AddParam('lc_ctype', CharacterSet.Text) |
338 |
|
else |
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 |
|
|
356 |
– |
initialization |
357 |
– |
{$i IBDatabaseEdit.lrs} |
371 |
|
|
372 |
|
end. |