ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/IBTransactionEdit.pas
(Generate patch)

Comparing ibx/trunk/design/IBTransactionEdit.pas (file contents):
Revision 1 by tony, Mon Jul 31 16:43:00 2000 UTC vs.
Revision 19 by tony, Mon Jul 7 13:00:15 2014 UTC

# 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 < interface
32 <
33 < uses
34 <  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
35 <  StdCtrls, IBDatabase, IB, ExtCtrls, IBXConst;
36 <
37 < type
38 <  TIBTransactionEditForm = class(TForm)
39 <    GroupBox1: TGroupBox;
40 <    HelpBtn: TButton;
41 <    Cancelbtn: TButton;
42 <    OKBtn: TButton;
43 <    rbSnapShot: TRadioButton;
44 <    rbReadCommitted: TRadioButton;
45 <    rbReadOnlyTableStability: TRadioButton;
46 <    rbReadWriteTableStability: TRadioButton;
47 <    TransactionParams: TMemo;
48 <    Panel1: TPanel;
49 <    Label1: TLabel;
50 <    procedure OKBtnClick(Sender: TObject);
51 <    procedure rbSnapShotClick(Sender: TObject);
52 <    procedure rbReadCommittedClick(Sender: TObject);
53 <    procedure rbReadOnlyTableStabilityClick(Sender: TObject);
54 <    procedure rbReadWriteTableStabilityClick(Sender: TObject);
55 <    procedure FormCreate(Sender: TObject);
56 <    procedure HelpBtnClick(Sender: TObject);
57 <    procedure TransactionParamsClick(Sender: TObject);
58 <    procedure TransactionParamsExit(Sender: TObject);
59 <
60 <  private
61 <    { Private declarations }
62 <    Transaction: TIBTransaction;
63 <    function Edit: Boolean;
64 <    procedure ParseParams;
65 <    procedure ClearParamSelection;
66 <
67 <  public
68 <    { Public declarations }
69 <  end;
70 <
71 < var
72 <  IBTransactionEditForm: TIBTransactionEditForm;
73 <
74 <  function EditIBtransaction(Atransaction: TIBtransaction): Boolean;
75 <
76 < implementation
77 <
78 < {$R *.DFM}
79 <
80 < uses
81 <  LibHelp;
82 <
83 < function EditIBtransaction(ATransaction: TIBtransaction): Boolean;
84 < begin
85 <  with TIBtransactionEditForm.Create(Application) do
86 <  try
87 <    Transaction := ATransaction;
88 <    Result := Edit;
89 <  finally
90 <    Free;
91 <  end;
92 < end;
93 <
94 < function TIBtransactionEditForm.Edit: Boolean;
95 < begin
96 <  TransactionParams.Lines := Transaction.Params;
97 <  ParseParams;
98 <  Result := False;
99 <  if ShowModal = mrOk then
100 <  begin
101 <    Transaction.Params := TransactionParams.Lines;
102 <    Result := True;
103 <  end;
104 < end;
105 <
106 < type
107 <  TTransactionParam = (concurrency, read_committed, rec_version, nowait,
108 <    consistency, read, write);
109 <  TTransactionParams = set of TTransactionParam;
110 <
111 < procedure TIBTransactionEditForm.ParseParams;
112 < var
113 <  I: Integer;
114 <  st: string;
115 <  Value: TTransactionParams;
116 <
117 < begin
118 <  Value := [];
119 <  for I := 0 to TransactionParams.Lines.Count - 1 do
120 <  begin
121 <    st := LowerCase(Trim(TransactionParams.Lines[I]));
122 <    if st = '' then
123 <      continue;
124 <    if st = 'concurrency' then
125 <      Include(Value, concurrency)
126 <    else if st = 'read_committed' then
127 <      Include(Value, read_committed)
128 <    else if st = 'rec_version' then
129 <      Include(Value, rec_version)
130 <    else if st = 'nowait' then
131 <      Include(Value, nowait)
132 <    else if st = 'read' then
133 <      Include(Value, read)
134 <    else if st = 'write' then
135 <      Include(Value, write)
136 <    else if st = 'consistency' then
137 <      Include(Value, consistency)
138 <    else begin
139 <      Value := [];
140 <      break;
141 <    end;
142 <  end;
143 <  ClearParamSelection;
144 <  if Value = [concurrency, nowait] then
145 <    rbSnapShot.Checked := True
146 <  else if Value = [read_committed, rec_version, nowait] then
147 <    rbReadCommitted.Checked := True
148 <  else if Value = [read, consistency] then
149 <    rbReadOnlyTableStability.Checked := True
150 <  else if Value = [write, consistency] then
151 <    rbReadWriteTableStability.Checked := True;
152 < end;
153 <
154 < procedure TIBTransactionEditForm.ClearParamSelection;
155 < begin
156 <  rbSnapShot.Checked := False;
157 <  rbReadCommitted.Checked := False;
158 <  rbReadOnlyTableStability.Checked := False;
159 <  rbReadWriteTableStability.Checked := False;
160 < end;
161 <
162 < procedure TIBTransactionEditForm.OKBtnClick(Sender: TObject);
163 < begin
164 <  ModalResult := mrNone;
165 <  if Transaction.Active then
166 <  begin
167 <    if MessageDlg(SCommitTransaction, mtConfirmation,
168 <      mbOkCancel, 0) <> mrOk then Exit;
169 <    Transaction.Rollback;
170 <  end;
171 <  ModalResult := mrOk;
172 < end;
173 <
174 < procedure TIBTransactionEditForm.FormCreate(Sender: TObject);
175 < begin
176 <  HelpContext := hcDIBTransactionEdit;
177 < end;
178 <
179 < procedure TIBTransactionEditForm.HelpBtnClick(Sender: TObject);
180 < begin
181 <  Application.HelpContext(HelpContext);
182 < end;
183 <
184 < procedure TIBTransactionEditForm.rbSnapShotClick(Sender: TObject);
185 < begin
186 <  TransactionParams.clear;
187 <  TransactionParams.Lines.Add('concurrency'); { do not localize }
188 <  TransactionParams.Lines.Add('nowait'); { do not localize }
189 < end;
190 <
191 < procedure TIBTransactionEditForm.rbReadCommittedClick(Sender: TObject);
192 < begin
193 <  TransactionParams.clear;
194 <  TransactionParams.Lines.Add('read_committed'); { do not localize }
195 <  TransactionParams.Lines.Add('rec_version'); { do not localize }
196 <  TransactionParams.Lines.Add('nowait'); { do not localize }
197 < end;
198 <
199 < procedure TIBTransactionEditForm.rbReadOnlyTableStabilityClick(Sender: TObject);
200 < begin
201 <  TransactionParams.clear;
202 <  TransactionParams.Lines.Add('read'); { do not localize }
203 <  TransactionParams.Lines.Add('consistency'); { do not localize }
204 < end;
205 <
206 < procedure TIBTransactionEditForm.rbReadWriteTableStabilityClick(Sender: TObject);
207 < begin
208 <  TransactionParams.clear;
209 <  TransactionParams.Lines.Add('write'); { do not localize }
210 <  TransactionParams.Lines.Add('consistency'); { do not localize }
211 < end;
212 <
213 < procedure TIBTransactionEditForm.TransactionParamsClick(Sender: TObject);
214 < begin
215 <  ClearParamSelection;
216 < end;
217 <
218 < procedure TIBTransactionEditForm.TransactionParamsExit(Sender: TObject);
219 < begin
220 <  ParseParams;
221 < end;
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 >
41 >  { TIBTransactionEditForm }
42 >
43 >  TIBTransactionEditForm = class(TForm)
44 >    GroupBox1: TGroupBox;
45 >    HelpBtn: TButton;
46 >    Cancelbtn: TButton;
47 >    OKBtn: TButton;
48 >    rbOtherButton: TRadioButton;
49 >    rbSnapShot: TRadioButton;
50 >    rbReadCommitted: TRadioButton;
51 >    rbReadOnlyTableStability: TRadioButton;
52 >    rbReadWriteTableStability: TRadioButton;
53 >    TransactionParams: TMemo;
54 >    Panel1: TPanel;
55 >    Label1: TLabel;
56 >    procedure OKBtnClick(Sender: TObject);
57 >    procedure rbSnapShotClick(Sender: TObject);
58 >    procedure rbReadCommittedClick(Sender: TObject);
59 >    procedure rbReadOnlyTableStabilityClick(Sender: TObject);
60 >    procedure rbReadWriteTableStabilityClick(Sender: TObject);
61 >    procedure FormCreate(Sender: TObject);
62 >    procedure HelpBtnClick(Sender: TObject);
63 >    procedure TransactionParamsClick(Sender: TObject);
64 >    procedure TransactionParamsExit(Sender: TObject);
65 >
66 >  private
67 >    { Private declarations }
68 >    Transaction: TIBTransaction;
69 >    function Edit: Boolean;
70 >    procedure ParseParams;
71 >    procedure ClearParamSelection;
72 >
73 >  public
74 >    { Public declarations }
75 >  end;
76 >
77 > var
78 >  IBTransactionEditForm: TIBTransactionEditForm;
79 >
80 >  function EditIBtransaction(Atransaction: TIBtransaction): Boolean;
81 >
82 > implementation
83 >
84 > {$R *.lfm}
85 >
86 > function EditIBtransaction(ATransaction: TIBtransaction): Boolean;
87 > begin
88 >  with TIBtransactionEditForm.Create(Application) do
89 >  try
90 >    Transaction := ATransaction;
91 >    Result := Edit;
92 >  finally
93 >    Free;
94 >  end;
95 > end;
96 >
97 > function TIBtransactionEditForm.Edit: Boolean;
98 > begin
99 >  TransactionParams.Lines := Transaction.Params;
100 >  ParseParams;
101 >  Result := False;
102 >  if ShowModal = mrOk then
103 >  begin
104 >    Transaction.Params := TransactionParams.Lines;
105 >    Result := True;
106 >  end;
107 > end;
108 >
109 > type
110 >  TTransactionParam = (concurrency, read_committed, rec_version, nowait,
111 >    consistency, read, write);
112 >  TTransactionParams = set of TTransactionParam;
113 >
114 > procedure TIBTransactionEditForm.ParseParams;
115 > var
116 >  I: Integer;
117 >  st: string;
118 >  Value: TTransactionParams;
119 >
120 > begin
121 >  Value := [];
122 >  for I := 0 to TransactionParams.Lines.Count - 1 do
123 >  begin
124 >    st := LowerCase(Trim(TransactionParams.Lines[I]));
125 >    if st = '' then
126 >      continue;
127 >    if st = 'concurrency' then
128 >      Include(Value, concurrency)
129 >    else if st = 'read_committed' then
130 >      Include(Value, read_committed)
131 >    else if st = 'rec_version' then
132 >      Include(Value, rec_version)
133 >    else if st = 'nowait' then
134 >      Include(Value, nowait)
135 >    else if st = 'read' then
136 >      Include(Value, read)
137 >    else if st = 'write' then
138 >      Include(Value, write)
139 >    else if st = 'consistency' then
140 >      Include(Value, consistency)
141 >    else begin
142 >      Value := [];
143 >      break;
144 >    end;
145 >  end;
146 >  ClearParamSelection;
147 >  if Value = [concurrency, nowait] then
148 >    rbSnapShot.Checked := True
149 >  else if Value = [read_committed, rec_version, nowait] then
150 >    rbReadCommitted.Checked := True
151 >  else if Value = [read, consistency] then
152 >    rbReadOnlyTableStability.Checked := True
153 >  else if Value = [write, consistency] then
154 >    rbReadWriteTableStability.Checked := True
155 >  else
156 >    rbOtherButton.Checked := true
157 > end;
158 >
159 > procedure TIBTransactionEditForm.ClearParamSelection;
160 > begin
161 >  rbSnapShot.Checked := False;
162 >  rbReadCommitted.Checked := False;
163 >  rbReadOnlyTableStability.Checked := False;
164 >  rbReadWriteTableStability.Checked := False;
165 > end;
166 >
167 > procedure TIBTransactionEditForm.OKBtnClick(Sender: TObject);
168 > begin
169 >  ModalResult := mrNone;
170 >  if Transaction.Active then
171 >  begin
172 >    if MessageDlg(SCommitTransaction, mtConfirmation,
173 >      mbOkCancel, 0) <> mrOk then Exit;
174 >    Transaction.Rollback;
175 >  end;
176 >  ModalResult := mrOk;
177 > end;
178 >
179 > procedure TIBTransactionEditForm.FormCreate(Sender: TObject);
180 > begin
181 > //  HelpContext := hcDIBTransactionEdit;
182 > end;
183 >
184 > procedure TIBTransactionEditForm.HelpBtnClick(Sender: TObject);
185 > begin
186 >  Application.HelpContext(HelpContext);
187 > end;
188 >
189 > procedure TIBTransactionEditForm.rbSnapShotClick(Sender: TObject);
190 > begin
191 >  TransactionParams.clear;
192 >  TransactionParams.Lines.Add('concurrency'); { do not localize }
193 >  TransactionParams.Lines.Add('nowait'); { do not localize }
194 > end;
195 >
196 > procedure TIBTransactionEditForm.rbReadCommittedClick(Sender: TObject);
197 > begin
198 >  TransactionParams.clear;
199 >  TransactionParams.Lines.Add('read_committed'); { do not localize }
200 >  TransactionParams.Lines.Add('rec_version'); { do not localize }
201 >  TransactionParams.Lines.Add('nowait'); { do not localize }
202 > end;
203 >
204 > procedure TIBTransactionEditForm.rbReadOnlyTableStabilityClick(Sender: TObject);
205 > begin
206 >  TransactionParams.clear;
207 >  TransactionParams.Lines.Add('read'); { do not localize }
208 >  TransactionParams.Lines.Add('consistency'); { do not localize }
209 > end;
210 >
211 > procedure TIBTransactionEditForm.rbReadWriteTableStabilityClick(Sender: TObject);
212 > begin
213 >  TransactionParams.clear;
214 >  TransactionParams.Lines.Add('write'); { do not localize }
215 >  TransactionParams.Lines.Add('consistency'); { do not localize }
216 > end;
217 >
218 > procedure TIBTransactionEditForm.TransactionParamsClick(Sender: TObject);
219 > begin
220 >  ClearParamSelection;
221 > end;
222 >
223 > procedure TIBTransactionEditForm.TransactionParamsExit(Sender: TObject);
224 > begin
225 >  ParseParams;
226 > end;
227 >
228 >
229 > end.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines