ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/IBTransactionEdit.pas
(Generate patch)
# Line 1 | Line 1
1 < {************************************************************************}
2 < {                                                                        }
3 < {       Borland Delphi Visual Component Library                          }
4 < {       InterBase Express core components                                }
5 < {                                                                        }
6 < {       Copyright (c) 1998-2000 Inprise Corporation                      }
7 < {                                                                        }
8 < {    InterBase Express is based in part on the product                   }
9 < {    Free IB Components, written by Gregory H. Deatz for                 }
10 < {    Hoagland, Longo, Moran, Dunst & Doukas Company.                     }
11 < {    Free IB Components is used under license.                           }
12 < {                                                                        }
13 < {    The contents of this file are subject to the InterBase              }
14 < {    Public License Version 1.0 (the "License"); you may not             }
15 < {    use this file except in compliance with the License. You            }
16 < {    may obtain a copy of the License at http://www.Inprise.com/IPL.html }
17 < {    Software distributed under the License is distributed on            }
18 < {    an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either              }
19 < {    express or implied. See the License for the specific language       }
20 < {    governing rights and limitations under the License.                 }
21 < {    The Original Code was created by InterBase Software Corporation     }
22 < {       and its successors.                                              }
23 < {    Portions created by Inprise Corporation are Copyright (C) Inprise   }
24 < {       Corporation. All Rights Reserved.                                }
25 < {    Contributor(s): Jeff Overcash                                       }
26 < {                                                                        }
27 < {************************************************************************}
28 <
29 < unit IBTransactionEdit;
30 <
31 < {$MODE Delphi}
32 <
33 < interface
34 <
35 < uses
36 <  {Windows,} Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
37 <  StdCtrls, IBDataBase, IB, ExtCtrls, IBXConst, LResources;
38 <
39 < type
40 <  TIBTransactionEditForm = class(TForm)
41 <    GroupBox1: TGroupBox;
42 <    HelpBtn: TButton;
43 <    Cancelbtn: TButton;
44 <    OKBtn: TButton;
45 <    rbSnapShot: TRadioButton;
46 <    rbReadCommitted: TRadioButton;
47 <    rbReadOnlyTableStability: TRadioButton;
48 <    rbReadWriteTableStability: TRadioButton;
49 <    TransactionParams: TMemo;
50 <    Panel1: TPanel;
51 <    Label1: TLabel;
52 <    procedure OKBtnClick(Sender: TObject);
53 <    procedure rbSnapShotClick(Sender: TObject);
54 <    procedure rbReadCommittedClick(Sender: TObject);
55 <    procedure rbReadOnlyTableStabilityClick(Sender: TObject);
56 <    procedure rbReadWriteTableStabilityClick(Sender: TObject);
57 <    procedure FormCreate(Sender: TObject);
58 <    procedure HelpBtnClick(Sender: TObject);
59 <    procedure TransactionParamsClick(Sender: TObject);
60 <    procedure TransactionParamsExit(Sender: TObject);
61 <
62 <  private
63 <    { Private declarations }
64 <    Transaction: TIBTransaction;
65 <    function Edit: Boolean;
66 <    procedure ParseParams;
67 <    procedure ClearParamSelection;
68 <
69 <  public
70 <    { Public declarations }
71 <  end;
72 <
73 < var
74 <  IBTransactionEditForm: TIBTransactionEditForm;
75 <
76 <  function EditIBtransaction(Atransaction: TIBtransaction): Boolean;
77 <
78 < implementation
79 <
80 < {$R *.lfm}
81 <
82 < function EditIBtransaction(ATransaction: TIBtransaction): Boolean;
83 < begin
84 <  with TIBtransactionEditForm.Create(Application) do
85 <  try
86 <    Transaction := ATransaction;
87 <    Result := Edit;
88 <  finally
89 <    Free;
90 <  end;
91 < end;
92 <
93 < function TIBtransactionEditForm.Edit: Boolean;
94 < begin
95 <  TransactionParams.Lines := Transaction.Params;
96 <  ParseParams;
97 <  Result := False;
98 <  if ShowModal = mrOk then
99 <  begin
100 <    Transaction.Params := TransactionParams.Lines;
101 <    Result := True;
102 <  end;
103 < end;
104 <
105 < type
106 <  TTransactionParam = (concurrency, read_committed, rec_version, nowait,
107 <    consistency, read, write);
108 <  TTransactionParams = set of TTransactionParam;
109 <
110 < procedure TIBTransactionEditForm.ParseParams;
111 < var
112 <  I: Integer;
113 <  st: string;
114 <  Value: TTransactionParams;
115 <
116 < begin
117 <  Value := [];
118 <  for I := 0 to TransactionParams.Lines.Count - 1 do
119 <  begin
120 <    st := LowerCase(Trim(TransactionParams.Lines[I]));
121 <    if st = '' then
122 <      continue;
123 <    if st = 'concurrency' then
124 <      Include(Value, concurrency)
125 <    else if st = 'read_committed' then
126 <      Include(Value, read_committed)
127 <    else if st = 'rec_version' then
128 <      Include(Value, rec_version)
129 <    else if st = 'nowait' then
130 <      Include(Value, nowait)
131 <    else if st = 'read' then
132 <      Include(Value, read)
133 <    else if st = 'write' then
134 <      Include(Value, write)
135 <    else if st = 'consistency' then
136 <      Include(Value, consistency)
137 <    else begin
138 <      Value := [];
139 <      break;
140 <    end;
141 <  end;
142 <  ClearParamSelection;
143 <  if Value = [concurrency, nowait] then
144 <    rbSnapShot.Checked := True
145 <  else if Value = [read_committed, rec_version, nowait] then
146 <    rbReadCommitted.Checked := True
147 <  else if Value = [read, consistency] then
148 <    rbReadOnlyTableStability.Checked := True
149 <  else if Value = [write, consistency] then
150 <    rbReadWriteTableStability.Checked := True;
151 < end;
152 <
153 < procedure TIBTransactionEditForm.ClearParamSelection;
154 < begin
155 <  rbSnapShot.Checked := False;
156 <  rbReadCommitted.Checked := False;
157 <  rbReadOnlyTableStability.Checked := False;
158 <  rbReadWriteTableStability.Checked := False;
159 < end;
160 <
161 < procedure TIBTransactionEditForm.OKBtnClick(Sender: TObject);
162 < begin
163 <  ModalResult := mrNone;
164 <  if Transaction.Active then
165 <  begin
166 <    if MessageDlg(SCommitTransaction, mtConfirmation,
167 <      mbOkCancel, 0) <> mrOk then Exit;
168 <    Transaction.Rollback;
169 <  end;
170 <  ModalResult := mrOk;
171 < end;
172 <
173 < procedure TIBTransactionEditForm.FormCreate(Sender: TObject);
174 < begin
175 < //  HelpContext := hcDIBTransactionEdit;
176 < end;
177 <
178 < procedure TIBTransactionEditForm.HelpBtnClick(Sender: TObject);
179 < begin
180 <  Application.HelpContext(HelpContext);
181 < end;
182 <
183 < procedure TIBTransactionEditForm.rbSnapShotClick(Sender: TObject);
184 < begin
185 <  TransactionParams.clear;
186 <  TransactionParams.Lines.Add('concurrency'); { do not localize }
187 <  TransactionParams.Lines.Add('nowait'); { do not localize }
188 < end;
189 <
190 < procedure TIBTransactionEditForm.rbReadCommittedClick(Sender: TObject);
191 < begin
192 <  TransactionParams.clear;
193 <  TransactionParams.Lines.Add('read_committed'); { do not localize }
194 <  TransactionParams.Lines.Add('rec_version'); { do not localize }
195 <  TransactionParams.Lines.Add('nowait'); { do not localize }
196 < end;
197 <
198 < procedure TIBTransactionEditForm.rbReadOnlyTableStabilityClick(Sender: TObject);
199 < begin
200 <  TransactionParams.clear;
201 <  TransactionParams.Lines.Add('read'); { do not localize }
202 <  TransactionParams.Lines.Add('consistency'); { do not localize }
203 < end;
204 <
205 < procedure TIBTransactionEditForm.rbReadWriteTableStabilityClick(Sender: TObject);
206 < begin
207 <  TransactionParams.clear;
208 <  TransactionParams.Lines.Add('write'); { do not localize }
209 <  TransactionParams.Lines.Add('consistency'); { do not localize }
210 < end;
211 <
212 < procedure TIBTransactionEditForm.TransactionParamsClick(Sender: TObject);
213 < begin
214 <  ClearParamSelection;
215 < end;
216 <
217 < procedure TIBTransactionEditForm.TransactionParamsExit(Sender: TObject);
218 < begin
219 <  ParseParams;
220 < end;
221 <
222 <
223 < end.
1 > {************************************************************************}
2 > {                                                                        }
3 > {       Borland Delphi Visual Component Library                          }
4 > {       InterBase Express core components                                }
5 > {                                                                        }
6 > {       Copyright (c) 1998-2000 Inprise Corporation                      }
7 > {                                                                        }
8 > {    InterBase Express is based in part on the product                   }
9 > {    Free IB Components, written by Gregory H. Deatz for                 }
10 > {    Hoagland, Longo, Moran, Dunst & Doukas Company.                     }
11 > {    Free IB Components is used under license.                           }
12 > {                                                                        }
13 > {    The contents of this file are subject to the InterBase              }
14 > {    Public License Version 1.0 (the "License"); you may not             }
15 > {    use this file except in compliance with the License. You            }
16 > {    may obtain a copy of the License at http://www.Inprise.com/IPL.html }
17 > {    Software distributed under the License is distributed on            }
18 > {    an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either              }
19 > {    express or implied. See the License for the specific language       }
20 > {    governing rights and limitations under the License.                 }
21 > {    The Original Code was created by InterBase Software Corporation     }
22 > {       and its successors.                                              }
23 > {    Portions created by Inprise Corporation are Copyright (C) Inprise   }
24 > {       Corporation. All Rights Reserved.                                }
25 > {    Contributor(s): Jeff Overcash                                       }
26 > {                                                                        }
27 > {************************************************************************}
28 >
29 > unit IBTransactionEdit;
30 >
31 > {$MODE Delphi}
32 >
33 > interface
34 >
35 > uses
36 >  {Windows,} Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
37 >  StdCtrls, IBDataBase, IB, ExtCtrls, IBXConst, LResources;
38 >
39 > type
40 >  TIBTransactionEditForm = class(TForm)
41 >    GroupBox1: TGroupBox;
42 >    HelpBtn: TButton;
43 >    Cancelbtn: TButton;
44 >    OKBtn: TButton;
45 >    rbSnapShot: TRadioButton;
46 >    rbReadCommitted: TRadioButton;
47 >    rbReadOnlyTableStability: TRadioButton;
48 >    rbReadWriteTableStability: TRadioButton;
49 >    TransactionParams: TMemo;
50 >    Panel1: TPanel;
51 >    Label1: TLabel;
52 >    procedure OKBtnClick(Sender: TObject);
53 >    procedure rbSnapShotClick(Sender: TObject);
54 >    procedure rbReadCommittedClick(Sender: TObject);
55 >    procedure rbReadOnlyTableStabilityClick(Sender: TObject);
56 >    procedure rbReadWriteTableStabilityClick(Sender: TObject);
57 >    procedure FormCreate(Sender: TObject);
58 >    procedure HelpBtnClick(Sender: TObject);
59 >    procedure TransactionParamsClick(Sender: TObject);
60 >    procedure TransactionParamsExit(Sender: TObject);
61 >
62 >  private
63 >    { Private declarations }
64 >    Transaction: TIBTransaction;
65 >    function Edit: Boolean;
66 >    procedure ParseParams;
67 >    procedure ClearParamSelection;
68 >
69 >  public
70 >    { Public declarations }
71 >  end;
72 >
73 > var
74 >  IBTransactionEditForm: TIBTransactionEditForm;
75 >
76 >  function EditIBtransaction(Atransaction: TIBtransaction): Boolean;
77 >
78 > implementation
79 >
80 > {$R *.lfm}
81 >
82 > function EditIBtransaction(ATransaction: TIBtransaction): Boolean;
83 > begin
84 >  with TIBtransactionEditForm.Create(Application) do
85 >  try
86 >    Transaction := ATransaction;
87 >    Result := Edit;
88 >  finally
89 >    Free;
90 >  end;
91 > end;
92 >
93 > function TIBtransactionEditForm.Edit: Boolean;
94 > begin
95 >  TransactionParams.Lines := Transaction.Params;
96 >  ParseParams;
97 >  Result := False;
98 >  if ShowModal = mrOk then
99 >  begin
100 >    Transaction.Params := TransactionParams.Lines;
101 >    Result := True;
102 >  end;
103 > end;
104 >
105 > type
106 >  TTransactionParam = (concurrency, read_committed, rec_version, nowait,
107 >    consistency, read, write);
108 >  TTransactionParams = set of TTransactionParam;
109 >
110 > procedure TIBTransactionEditForm.ParseParams;
111 > var
112 >  I: Integer;
113 >  st: string;
114 >  Value: TTransactionParams;
115 >
116 > begin
117 >  Value := [];
118 >  for I := 0 to TransactionParams.Lines.Count - 1 do
119 >  begin
120 >    st := LowerCase(Trim(TransactionParams.Lines[I]));
121 >    if st = '' then
122 >      continue;
123 >    if st = 'concurrency' then
124 >      Include(Value, concurrency)
125 >    else if st = 'read_committed' then
126 >      Include(Value, read_committed)
127 >    else if st = 'rec_version' then
128 >      Include(Value, rec_version)
129 >    else if st = 'nowait' then
130 >      Include(Value, nowait)
131 >    else if st = 'read' then
132 >      Include(Value, read)
133 >    else if st = 'write' then
134 >      Include(Value, write)
135 >    else if st = 'consistency' then
136 >      Include(Value, consistency)
137 >    else begin
138 >      Value := [];
139 >      break;
140 >    end;
141 >  end;
142 >  ClearParamSelection;
143 >  if Value = [concurrency, nowait] then
144 >    rbSnapShot.Checked := True
145 >  else if Value = [read_committed, rec_version, nowait] then
146 >    rbReadCommitted.Checked := True
147 >  else if Value = [read, consistency] then
148 >    rbReadOnlyTableStability.Checked := True
149 >  else if Value = [write, consistency] then
150 >    rbReadWriteTableStability.Checked := True;
151 > end;
152 >
153 > procedure TIBTransactionEditForm.ClearParamSelection;
154 > begin
155 >  rbSnapShot.Checked := False;
156 >  rbReadCommitted.Checked := False;
157 >  rbReadOnlyTableStability.Checked := False;
158 >  rbReadWriteTableStability.Checked := False;
159 > end;
160 >
161 > procedure TIBTransactionEditForm.OKBtnClick(Sender: TObject);
162 > begin
163 >  ModalResult := mrNone;
164 >  if Transaction.Active then
165 >  begin
166 >    if MessageDlg(SCommitTransaction, mtConfirmation,
167 >      mbOkCancel, 0) <> mrOk then Exit;
168 >    Transaction.Rollback;
169 >  end;
170 >  ModalResult := mrOk;
171 > end;
172 >
173 > procedure TIBTransactionEditForm.FormCreate(Sender: TObject);
174 > begin
175 > //  HelpContext := hcDIBTransactionEdit;
176 > end;
177 >
178 > procedure TIBTransactionEditForm.HelpBtnClick(Sender: TObject);
179 > begin
180 >  Application.HelpContext(HelpContext);
181 > end;
182 >
183 > procedure TIBTransactionEditForm.rbSnapShotClick(Sender: TObject);
184 > begin
185 >  TransactionParams.clear;
186 >  TransactionParams.Lines.Add('concurrency'); { do not localize }
187 >  TransactionParams.Lines.Add('nowait'); { do not localize }
188 > end;
189 >
190 > procedure TIBTransactionEditForm.rbReadCommittedClick(Sender: TObject);
191 > begin
192 >  TransactionParams.clear;
193 >  TransactionParams.Lines.Add('read_committed'); { do not localize }
194 >  TransactionParams.Lines.Add('rec_version'); { do not localize }
195 >  TransactionParams.Lines.Add('nowait'); { do not localize }
196 > end;
197 >
198 > procedure TIBTransactionEditForm.rbReadOnlyTableStabilityClick(Sender: TObject);
199 > begin
200 >  TransactionParams.clear;
201 >  TransactionParams.Lines.Add('read'); { do not localize }
202 >  TransactionParams.Lines.Add('consistency'); { do not localize }
203 > end;
204 >
205 > procedure TIBTransactionEditForm.rbReadWriteTableStabilityClick(Sender: TObject);
206 > begin
207 >  TransactionParams.clear;
208 >  TransactionParams.Lines.Add('write'); { do not localize }
209 >  TransactionParams.Lines.Add('consistency'); { do not localize }
210 > end;
211 >
212 > procedure TIBTransactionEditForm.TransactionParamsClick(Sender: TObject);
213 > begin
214 >  ClearParamSelection;
215 > end;
216 >
217 > procedure TIBTransactionEditForm.TransactionParamsExit(Sender: TObject);
218 > begin
219 >  ParseParams;
220 > end;
221 >
222 >
223 > end.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines