Skip to content

Commit 580e1c0

Browse files
Add files via upload
1 parent f20d079 commit 580e1c0

File tree

77 files changed

+15222
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+15222
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
program DataReader;
2+
3+
uses
4+
Forms,
5+
fDataReader in 'fDataReader.pas' {frmDataReader},
6+
fODBCMainCompBase in '..\..\fODBCMainCompBase.pas' {frmODBCMainCompBase},
7+
ADONetUtils in '..\..\..\..\Utils\ADONetUtils.pas',
8+
uDatSUtils in '..\..\..\..\VirtualTables\uDatSUtils.pas';
9+
10+
{$R *.res}
11+
12+
begin
13+
Application.Initialize;
14+
Application.MainFormOnTaskbar := True;
15+
Application.CreateForm(TfrmDataReader, frmDataReader);
16+
Application.CreateForm(TfrmODBCMainCompBase, frmODBCMainCompBase);
17+
Application.Run;
18+
end.
19+

‎Demos/Odbc/CSV/TOdbcDataReader/Main/DataReader.dproj

Lines changed: 470 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
inherited frmDataReader: TfrmDataReader
2+
Caption = 'Data Reader'
3+
PixelsPerInch = 96
4+
TextHeight = 13
5+
inherited pnlTitle: TPanel
6+
inherited lblTitle: TLabel
7+
Width = 131
8+
Caption = 'Data Reader'
9+
ExplicitWidth = 131
10+
end
11+
end
12+
inherited pnlMain: TPanel
13+
inherited pnl1: TPanel
14+
object mmoConsole: TMemo
15+
Left = -5
16+
Top = 0
17+
Width = 591
18+
Height = 293
19+
Align = alCustom
20+
Anchors = [akLeft, akTop, akRight, akBottom]
21+
Font.Charset = DEFAULT_CHARSET
22+
Font.Color = clWindowText
23+
Font.Height = -13
24+
Font.Name = 'Courier New'
25+
Font.Style = []
26+
ParentFont = False
27+
ScrollBars = ssBoth
28+
TabOrder = 0
29+
end
30+
end
31+
end
32+
object OdbcDataReader1: TOdbcDataReader
33+
Connection = OdbcConnection1
34+
Parameters = <>
35+
Left = 328
36+
Top = 312
37+
end
38+
end
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
unit fDataReader;
2+
3+
interface
4+
5+
uses
6+
Windows, Messages, SysUtils, Variants, Classes, Graphics,
7+
Controls, Forms, Dialogs, fODBCMainCompBase,
8+
CNClrLib.ADONet.Enums, CNClrLib.ADONet.Error, CNClrLib.ADONet.EventArgs,
9+
CNClrLib.ADONet.OdbcEventArgs, CNClrLib.ADONet.Client, CNClrLib.ADONet.Odbc,
10+
StdCtrls, DB, Buttons, ExtCtrls;
11+
12+
type
13+
TfrmDataReader = class(TfrmODBCMainCompBase)
14+
mmoConsole: TMemo;
15+
OdbcDataReader1: TOdbcDataReader;
16+
procedure btnConnectClick(Sender: TObject);
17+
public
18+
{ Public declarations }
19+
end;
20+
21+
var
22+
frmDataReader: TfrmDataReader;
23+
24+
implementation
25+
26+
{$R *.dfm}
27+
28+
uses uDatSUtils, CNClrLib.ADONetWrapper;
29+
30+
procedure PrintHeader(Reader: TOdbcDataReader; AConsole: TStrings;
31+
const ALabel: String = ''; AWithState: Boolean = False);
32+
var
33+
i: Integer;
34+
s: String;
35+
begin
36+
if ALabel <> '' then
37+
AConsole.Add(ALabel);
38+
with Reader do
39+
begin
40+
s := '';
41+
for i := 0 to VisibleFieldCount - 1 do
42+
s := s + ' ' + GetName(i);
43+
AConsole.Add(s);
44+
end;
45+
end;
46+
47+
procedure PrintRow(Reader: TOdbcDataReader; AConsole: TStrings);
48+
var
49+
i: Integer;
50+
s: String;
51+
begin
52+
with Reader do
53+
begin
54+
s := '';
55+
for i := 0 to VisibleFieldCount - 1 do
56+
s := s + ' ' + VarToWideStr(GetValue(i));
57+
AConsole.Add(s);
58+
end;
59+
end;
60+
61+
procedure TfrmDataReader.btnConnectClick(Sender: TObject);
62+
var
63+
i: Integer;
64+
newRow: _DataRow;
65+
begin
66+
inherited;
67+
// Setup data read and forward only read data from the database
68+
OdbcDataReader1.CommandText.Text := 'select * from Customers.csv';
69+
OdbcDataReader1.Open;
70+
PrintHeader(OdbcDataReader1, mmoConsole.Lines, 'Fetched rows ----------------');
71+
72+
while OdbcDataReader1.Read do
73+
PrintRow(OdbcDataReader1, mmoConsole.Lines);
74+
75+
OdbcDataReader1.Close;
76+
end;
77+
78+
end.
79+
80+
81+
82+
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+
fMainQueryBase in '..\fMainQueryBase.pas' {frmMainQueryBase},
6+
fFilter in 'fFilter.pas' {frmFilter},
7+
fODBCMainCompBase in '..\..\fODBCMainCompBase.pas' {frmODBCMainCompBase},
8+
ADONetUtils in '..\..\..\..\Utils\ADONetUtils.pas';
9+
10+
{$R *.res}
11+
12+
begin
13+
Application.Initialize;
14+
Application.MainFormOnTaskbar := True;
15+
Application.CreateForm(TfrmFilter, frmFilter);
16+
Application.CreateForm(TfrmMainQueryBase, frmMainQueryBase);
17+
Application.CreateForm(TfrmODBCMainCompBase, frmODBCMainCompBase);
18+
Application.Run;
19+
end.

0 commit comments

Comments
 (0)