Skip to content

Commit 0da364d

Browse files
Add files via upload
1 parent 742899e commit 0da364d

30 files changed

+6202
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
program Qry_CachedUpdates;
2+
3+
uses
4+
Forms,
5+
fMainQueryBase in '..\fMainQueryBase.pas' {frmMainQueryBase},
6+
fCachedUpdates in 'fCachedUpdates.pas' {frmCachedUpdates},
7+
fORACLEMainCompBase in '..\..\fORACLEMainCompBase.pas' {frmORACLEMainCompBase};
8+
9+
{$R *.res}
10+
11+
begin
12+
Application.Initialize;
13+
Application.MainFormOnTaskbar := True;
14+
Application.CreateForm(TfrmCachedUpdates, frmCachedUpdates);
15+
Application.CreateForm(TfrmMainQueryBase, frmMainQueryBase);
16+
Application.CreateForm(TfrmORACLEMainCompBase, frmORACLEMainCompBase);
17+
Application.Run;
18+
end.

‎Demos/OracleClient/TOracleClientQuery/CachedUpdates/Qry_CachedUpdates.dproj

Lines changed: 564 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
inherited frmCachedUpdates: TfrmCachedUpdates
2+
Caption = 'Cached Updates'
3+
ExplicitHeight = 576
4+
PixelsPerInch = 96
5+
TextHeight = 13
6+
inherited pnlTitle: TPanel
7+
inherited lblTitle: TLabel
8+
Width = 398
9+
Caption = 'Cached Updates and OnUpdateRecord'
10+
ExplicitWidth = 398
11+
end
12+
end
13+
inherited pnlMain: TPanel
14+
inherited pnl1: TPanel
15+
inherited pgcMain: TPageControl
16+
inherited tsData: TTabSheet
17+
ExplicitLeft = 4
18+
ExplicitTop = 27
19+
ExplicitWidth = 578
20+
ExplicitHeight = 308
21+
object pnl2: TPanel
22+
Left = 0
23+
Top = 274
24+
Width = 578
25+
Height = 34
26+
Align = alBottom
27+
BevelOuter = bvNone
28+
ParentColor = True
29+
TabOrder = 0
30+
object btnApply: TButton
31+
Left = 254
32+
Top = 6
33+
Width = 84
34+
Height = 25
35+
Caption = 'Apply Updates'
36+
TabOrder = 0
37+
OnClick = btnApplyClick
38+
end
39+
object btnCancel: TButton
40+
Left = 347
41+
Top = 6
42+
Width = 100
43+
Height = 25
44+
Caption = 'Cancel Updates'
45+
TabOrder = 1
46+
OnClick = btnCancelClick
47+
end
48+
object btnRevert: TButton
49+
Left = 454
50+
Top = 6
51+
Width = 83
52+
Height = 25
53+
Caption = 'Revert Record'
54+
TabOrder = 2
55+
OnClick = btnRevertClick
56+
end
57+
object dbnvgr1: TDBNavigator
58+
Left = 2
59+
Top = 6
60+
Width = 240
61+
Height = 25
62+
DataSource = dsProducts
63+
TabOrder = 3
64+
end
65+
end
66+
object dbgrd1: TDBGrid
67+
Left = 0
68+
Top = 0
69+
Width = 578
70+
Height = 274
71+
Align = alClient
72+
DataSource = dsProducts
73+
TabOrder = 1
74+
TitleFont.Charset = DEFAULT_CHARSET
75+
TitleFont.Color = clWindowText
76+
TitleFont.Height = -11
77+
TitleFont.Name = 'Tahoma'
78+
TitleFont.Style = []
79+
end
80+
end
81+
inherited tsOptions: TTabSheet
82+
ExplicitLeft = 4
83+
ExplicitTop = 27
84+
ExplicitWidth = 578
85+
ExplicitHeight = 308
86+
inherited pnlTree: TPanel
87+
inherited grp2: TGroupBox
88+
inherited cbUpdateMode: TComboBox
89+
Enabled = False
90+
end
91+
end
92+
end
93+
end
94+
object ts1: TTabSheet
95+
Caption = 'OnUpdaterecord Log'
96+
ImageIndex = 2
97+
ExplicitLeft = 0
98+
ExplicitTop = 0
99+
ExplicitWidth = 0
100+
ExplicitHeight = 0
101+
object mmoLog: TMemo
102+
Left = 0
103+
Top = 0
104+
Width = 578
105+
Height = 308
106+
Align = alClient
107+
ScrollBars = ssVertical
108+
TabOrder = 0
109+
end
110+
end
111+
end
112+
end
113+
end
114+
object OracleClientQueryProducts: TOracleClientQuery
115+
Connection = OracleClientConnection1
116+
FetchOptions.Unidirectional = False
117+
UpdateOptions.UpdateMode = umBatch
118+
Parameters = <>
119+
SQL.Strings = (
120+
'Select * from Products')
121+
OnUpdateRecord = OracleClientQueryProductsUpdateRecord
122+
Left = 308
123+
Top = 239
124+
end
125+
object dsProducts: TDataSource
126+
DataSet = OracleClientQueryProducts
127+
Left = 448
128+
Top = 240
129+
end
130+
end
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
unit fCachedUpdates;
2+
3+
interface
4+
5+
uses
6+
Windows, Messages, SysUtils, Variants, Classes, Graphics,
7+
Controls, Forms, Dialogs, fMainQueryBase, CNClrLib.ADONet.Enums,
8+
CNClrLib.ADONet.Error, CNClrLib.ADONet.EventArgs,
9+
CNClrLib.ADONet.OracleEventArgs, DB, CNClrLib.ADONet.Client,
10+
CNClrLib.ADONet.OracleClient, StdCtrls, Grids, DBGrids,
11+
DBCtrls, ExtCtrls, Buttons, ComCtrls;
12+
13+
type
14+
TfrmCachedUpdates = class(TfrmMainQueryBase)
15+
pnl2: TPanel;
16+
btnApply: TButton;
17+
btnCancel: TButton;
18+
btnRevert: TButton;
19+
dbgrd1: TDBGrid;
20+
OracleClientQueryProducts: TOracleClientQuery;
21+
dsProducts: TDataSource;
22+
ts1: TTabSheet;
23+
mmoLog: TMemo;
24+
dbnvgr1: TDBNavigator;
25+
procedure btnApplyClick(Sender: TObject);
26+
procedure btnCancelClick(Sender: TObject);
27+
procedure btnRevertClick(Sender: TObject);
28+
procedure btnConnectClick(Sender: TObject);
29+
procedure OracleClientQueryProductsUpdateRecord(Sender: TObject;
30+
EventArgs: TRowUpdatedEventArgs);
31+
procedure FormCreate(Sender: TObject);
32+
private
33+
{ Private declarations }
34+
public
35+
{ Public declarations }
36+
end;
37+
38+
var
39+
frmCachedUpdates: TfrmCachedUpdates;
40+
41+
implementation
42+
43+
{$R *.dfm}
44+
45+
uses
46+
TypInfo;
47+
48+
procedure TfrmCachedUpdates.btnApplyClick(Sender: TObject);
49+
begin
50+
OracleClientQueryProducts.UpdateBatch;
51+
end;
52+
53+
procedure TfrmCachedUpdates.btnCancelClick(Sender: TObject);
54+
begin
55+
OracleClientQueryProducts.CancelBatch;
56+
end;
57+
58+
procedure TfrmCachedUpdates.btnConnectClick(Sender: TObject);
59+
begin
60+
inherited;
61+
OracleClientQueryProducts.Close;
62+
OracleClientQueryProducts.Open;
63+
with OracleClientQueryProducts.FieldByName('ProductID') do
64+
ProviderFlags := [pfInWhere, pfInKey];
65+
end;
66+
67+
procedure TfrmCachedUpdates.btnRevertClick(Sender: TObject);
68+
begin
69+
OracleClientQueryProducts.RevertRecord;
70+
end;
71+
72+
procedure TfrmCachedUpdates.FormCreate(Sender: TObject);
73+
begin
74+
inherited;
75+
RegisterDS(OracleClientQueryProducts);
76+
end;
77+
78+
procedure TfrmCachedUpdates.OracleClientQueryProductsUpdateRecord(Sender: TObject;
79+
EventArgs: TRowUpdatedEventArgs);
80+
var
81+
oMsg: string;
82+
begin
83+
oMsg := 'Records Affected: '+ IntToStr(EventArgs.RecordsAffected) + #13#10 +
84+
'RowCount: '+ IntToStr(EventArgs.RowCount) + #13#10 +
85+
'Status: '+ TypInfo.GetEnumName(TypeInfo(TUpdateStatus_), Ord(EventArgs.Status)) + #13#10 +
86+
'StatementType: '+ TypInfo.GetEnumName(TypeInfo(TStatementType), Ord(EventArgs.StatementType)) + #13#10;
87+
88+
if EventArgs.Errors <> nil then
89+
oMsg := oMsg + 'ErrorMessage: '+ EventArgs.Errors.Message;
90+
91+
mmoLog.Lines.Add(oMsg);
92+
mmoLog.Lines.Add('****************************');
93+
mmoLog.Lines.Add('');
94+
end;
95+
96+
end.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
program Filter;
2+
3+
uses
4+
Forms,
5+
fFilter in 'fFilter.pas' {frmFilter},
6+
fORACLEMainCompBase in '..\..\fORACLEMainCompBase.pas' {frmORACLEMainCompBase},
7+
fMainQueryBase in '..\fMainQueryBase.pas' {frmMainQueryBase};
8+
9+
{$R *.res}
10+
11+
begin
12+
Application.Initialize;
13+
Application.MainFormOnTaskbar := True;
14+
Application.CreateForm(TfrmFilter, frmFilter);
15+
Application.CreateForm(TfrmMainQueryBase, frmMainQueryBase);
16+
Application.CreateForm(TfrmORACLEMainCompBase, frmORACLEMainCompBase);
17+
Application.CreateForm(TfrmMainQueryBase, frmMainQueryBase);
18+
Application.Run;
19+
end.

0 commit comments

Comments
 (0)