Открыть Электронные книги
Категории
Открыть Аудиокниги
Категории
Открыть Журналы
Категории
Открыть Документы
Категории
Builderv
BDE, InterBase Express, ADO Express (dbGo) dbExpress
-
(, )
SQL SQL ANSI-92
dbExpress
MyBase
Quick Report Decision Cube
,
32.973.2
681.3.06(075)
-68
..
-68
ISBN 5-93772-094-6
,
Borland C++ Bulder 6
,
, - .
Paradox Interbase SQL
.
. , . , ^
. :
BDE ,
. BDE, SQL.
Interbase SQL,
SQL-92. dbExpress, MyBase
Briefcase. , ,
Quick Report Decision Cube.
.
32.973.2
.
.
.
, , , . ,
, , .
ISBN 5-93772-094-6
.., 2003
, 2003
77.99.6.953..438.2.9. 04.02.1999
1.
C++ Builder 6
10
12
12
14
SQL Explorer
20
21
24
Database Desktop
26
26
28
2.
29
..
30
Items
(Fields)
TDataSource
34
35
36
37
40
47
50
60
66
67
70
72
TField
, TField
.
(Calculated Fields)
75
78
82
85
"
(Lookup Fields)
8i
9
9J
10(
102
3.
()
103
101
TDatabase
TDatabase
BDE
TDatabase
10
106
10S
111
113
TSession 114
TSession
115
Paradox dBASE.... 117
119
121
,
( TDBChart)
TDBCtrlGrid
( TDBGrid)
Columns. TColumn
OnTitleClick
OnDrawColumnCell
128
128
130
131
135
136
136
144
149
149
TQuery
SQL
159
159
160
160
760
161
153
.'
(DML)
(Select)
Select
From
Where
Group By.
Having
Order By
(Delete)
(Insert)
(Update)
(Union)
SQL
(DDL)
(Create Table)
(Alter Table)
(Drop Table)
(Create Index)
(Drop Index)
161
161
161
762
765
768
768
769
169
169
170
170
171
171
173
173
175
175
175
176
SQL TQuery.
(SQL Builder)
RequestLive
176
179
180
182
TUpdateSQL
182
TBatchMove
189
192
193
4. -
195
Interbase
Interbase (IBConsole)
ISQL
196
197
202
Interbase
, Interbase
SQL
204
204
205
206
(Domains)
(Generators), (Triggers)
(Stored Procedures)
(Views)
(Exceptions)
209
211
216
277
226
229
230
dbExpress
IBExpress
dbGo (ADO)
dbExpress
TSQLTable
TSQLQuery, TSQLStoredProc TSQLDataSet
TSQLCIientDataSet
TSQLMonitor
232
233
234
237
240
245
246
260
263
270
273
5.
275
QuickReport
TQuickRep
Quick Report
275
276
279
282
291
296
Decision Cube
297
302
304
, ,
, . , , Oracle,
,
(Paradox, dBASE .).
.
.
. .
,
, .
, , .
Borland C++ Builder.
,
BDE, C++ Builder
. 6.
, Borland C++ Builder 6 . dbExpress
SQL (DB2, Oracle, Interbase
.). (
) dbExpress , - (CLX).
C++ Builder . BDE dbExpress,
IB Express ADO Express (
dbGo). IB Express Interbase, ,
. dbGo,
Microsoft OLE DB, , ., MS Access MS SQL
Server ( , Microsoft).
, BDE ( , ), ,
( ), .
(Paradox, dBASE).
- Interbase dbExpress.
.
, , .
., , )
, ,
.
( ). Borlan
C++ Builder ,
, ,
. SQL Explorer,
Database Desktop.
.
BDE.
TDataSet <
. , ,
, , .
, .
TDataSource TField,
, .
Master/Detail , , .
BDE . , TDatabase TSession. , Data Controls. TDBGrid (),
. SQL, (Paradox, dBASE, Foxpro ).
TDataSet TQuery.
.
TUpdateSQL TBatchMove, .
, . Interbase.
IBConsole Interactive SQL. ,
IBConsole Interbase,
, Interbase. Interactive SQL,
SQL .
Interbase. , Interbase, SQL Interbase, Interbase,
. ,
- :
dbExpress, IBExpress dbGo (ADO) Interbase, dbExpress,
,
MyBase. TSQLMonitor.
, . Quick Report Decision Cube. ,
.
, . !
C++Builder
SQL Explorer Database Desktop
, ,
C++,
, . , ,
C/C++.
. , ,
- .
C/C++
C++ Builder Borland. Borland (Borland
Database Engine, , , BDE). BDE DLL,
. BDE (Paradox, dBASE, ) SQL (Oracle, DB2, Informix, Interbase, MS SQL
Server .). ODBC (Open Database Connectivity),
, Access, Excel, FoxPro, Btrieve
.
,
.
Borland C++ Builder . C++ Builder
, , , -
1. C++ Builder 6
. , , . C++ Builder .
BDE :
G dbExpress, SQL.
Q ADOExpress ,
ADO. ,
Microsoft,
OLE DB.
G IBExpress ,
Interbase Interbase, BDE.
, ,
. ,
, , Windows . (
, , ..) Quick
Report (QReport) Decision Cube.
()
C++ Builder 6 ( MIDAS),
( 2, Business-To-Business, Web Services), .
( )
,
, ,
. ,
,
,
, , ,
,
.
, Borland C++ Builder 6.
, . , , SQL Explorer Database
Desktop. ,
, .
, , .
I2
:
Borland C++ Builder 6 !
, .
, ;
, .
(
,
, !
, , . , /
,
, , ,
, , .
, ,
, . ,
, ,
.
, . ,
.
(Database Application) , ,
. ,
() ,
, . :
,
.
,
(, ,
),
. , ()
(Data Model).
. ,
.
, . .
.
, , . ,
.
, .
, , -
1. C++ Builder
, .
(, ..), ,
, ,
, .
, OLE DB,
ADO, .
. ( !), , . .
Q .
( )
. ()
.
(, ) . ,
,
, . ,
,
. dBASE, FoxPro, Paradox.
- , , . , , -
. (..
, ) .
, , . ,
. - .
Microsoft Access.
Q - , , ,
. - . -
,
. , (, ).
- ,
.
( ), (- ),
14
.
SQL-, SQL-;
. SQL-;
, , Interbase, Oracle, DB2, Sybase, Informix, MS SQL Serv<
, .
Q . (multi-tiered)
- . nepcnei
.
.
, cej
. ,
.
,
.
.
, , ,
, . !
,
,
. ]
( , )
.
.
, . {
, , , i
. , , ?
, .
, ,
.
. , ,
, - ().
.
.
- , -
. -
, - ,
, . , , , , , . ,
,
1. C++ Builder 6
15
,
.
,
. , . ,
,
. , .
, , , .
,
.
Q . ,
, .
, , , . ,
,
. ,
.
.
, ,
. : .
.
, ,
,
1-2 ,
. , ,
.
. , , .
, ,
. . , -.
Q , .
, (, ), .
, (),
. ,
(), .
Q , .
, ,
10
. ,
, - .
, , .
, , ,
. .
1. , .
, .
,
, .
.
, . , ,
.
?
?
?
?
,
, .
? , ,
, ,
, ? .
?
?
?
. ,
, ( ) ,
, ..
, , ?
, , , ?
, ?
? (,
.
: , ..)
() , ,
?
1. C++ Builder
17
- , . , .
2. () .
() .
, .
, , () , , ,
, .. ,
. ,
, , , , Web-
. ,
() .
. , ,
.
, ,
.
.
(Normalization).
5. () . , ,
. ,
. , .
t. , .
,
. (
) (Primary Key). . ,
, , ,
. ,
, , , . ,
. , ,
. , ,
. , ,
, , .
, ,
, ,
. .
() .
10
. ,
.
,
, (Foreign Keys,
, (
), :
!
( ) !
. .
5. , !
, .
() ,
. , ,
, , .
, , ,
.. , , ,
: , - !
NULL (..
),
(.. *
, ).
6. }!
, . .
, .
, . ,
. . ,
, .
, ,
, . ,
, Big Technologies, 5. ,
5, Big Technologies. , - 5,
,
5. , , (Referential Integrity). ,
,
, .
.
( Microsoft Access CASE-)
SQL-.
,
, .
1. C++ Builder 6
--. ( ) .
. - --. -- , .
.
.
-- .
, , , --. -- .
, .
, ,
-. , . ,
-,
-.
. .
7. .
, ,
,
. , ,
, . ,
, ,
. ,
.
. ,
.
, . , . ,
, . ,
,
, . , , ,
.
, .
.
, ,
. ,
, . ,
, .
. , ,
, (, 100 000)
.
, 100 , .
8. . ,
,
,
. , .
:
; . (, , Microsoft Access, Interbase).
,
.
, .
(
, ). - , ,
.
, . : , ,
.
, C++
Builder 6, SQL Explorer (Database Explorer) Database Desktop. ,
. ,
, , ,
, .
SQL Explorer
SQL Explorer ,
. , , ,
. ,
SQL-. , SQL Explorer'a (Alias) , (Dictionary)
(Attribute Set). .
1. C++ Builder 6
21
X .- : ':
Definition 1
) Databases
+. Ho DefauHDD
+ *o IBLocal
t; TJ myAccees
P. Access
:*j Ti Visual FoxPro
"S " & Visual FoxPro
-f. TJ dBASE
jj TS Excel
Type
STANDARD
DEFAULT DRIVER PARADOX
ENABLE BCD
FALSE
PATH
Deprogram Files\Common Files\Boriwid Shoied\Data
Databases
(Aliases). (Alias) , , BDE (Borland Database Engine) . SQL Explorer,
BDE Administrator Database Desktop, .
, BDE,
, .
SQL Explorer ,
. , C++
Builder BCDEMOS,
DefaultDD, IBLocal (. . 1.1). Paradox,
22
Interbase ( ,
, Interbase). , !
, <
ODBC ( . 1.1 ).
, ODBC
. , DSN- (Data Sourc
Name). ODBC (32
(ODBC Administrator), ,
(Control Panel)
Object SQL Explorer.
. New Object Hi
,
(. . 1.2). ( ): STANDARD, MSACCESS, SYBASE, ORACLE,
MSSQL, INFORMIX, DB2, INTRBASE. , , , . STANDARD Paradox
( db), dBASE FoxPro ( /^),
( txt). , . , Apply
Object.
1. C++ Builder 6
23
Databases jpidronaryj
;-; Q) Databases
EV BCDEMOS
:
& Tables
- animals dbt
Ms
: : Ot NAME
: ilH SIZE
i ; t DB WEIGHT
: AREA
_*j
_J
Prnls
Nome
: Type
Siie
NAME
CHARACTER 10
SEE
NUMERIC
EWEIGHT NUMERIC
2
fflAREA
CHARACTER 20
BMP
BINARY
10
H,y
10
10
; BMP
Indices
.fiUfl VelidiV Checks
1 Referential Constraints
i ,*i gg Securrty Specs
| b'fil FamiV Members
5Fld,,,l-:.db.,
. _. i. j i
Jj
. 1.3. animals ,
BCDEMOS
SQL Explorer
. , , . . ,
STANDARD ,
MSACCESS .
SQL-. , Interbase .
: Domains (), Views (), Procedures (),
Functions (), Generators (), Exceptions () Blob Filters
( Blob).
. Interbase SYSDBA
masterkey.
. , SQL ,
. ,
Interbase IBConsole, InterBase Guardian.
24
, , .
Apply Object.
- Ctrl + A.B .
, ,
: , , , ^
, .. . 1.3
Summary animals (
BCDEMOS. ,
..
SQL Explorer
. ,
Data.
, . HI
, SQL Explorer. ITpi
,
, .
! Detnbane Aliases
Detebages j Dicjionaty
Databases
6CDEWOS
Tables
!* H animals dbf
*. bk)lTte,db
1
QD countrydb
cusioiy.dQ
OS customer db
!__ employee. db
jj ^
<l
-IJ . ""
^i
tj <} '
-M-:-
_>J
. 1.4.
Enter SQL. ,
.
SQL. Execute Query
. . 1.4 .
.
, SQL- .
(Dictionary) , .
. (Attribute Set) ,
() . . 1.5
CustNo. , , , .
1. C++ Builder 6
25
. 1.5. CustNo
.
,
,
( ). ,
, ,
. , ,
.
, New Object.
, , ,
( Close Object). Create a new
Dictionary (. . 1.6). (
), ( Databases) ,
. , .
:". ( IBLocal
26
( Databases).
Databases Dictionary.
SQL Explorer.
DatabaseDesktop
Database Desktop , SQL Explorer.
Paradox,
dBASE SQL, , , , , , . Database Desktop .
Database Desktop Tools,
dbd32.exe. /Common Files/Borland Shared/
Database Desktop/. , Database Desktop. .
, New \
Table File. Create Table
(, ).
Paradox dBASE, ODBC SQL-. : FOXPRO, MSACCESS,
SYBASE, ORACLE, INFORMIX, MSSQL, DB2 INTRBASE.
, Create Table. . 1.7 Interbase.
:teble>_StoreNo
s-tor,.
. 1.7. Interbase
Create Table ,
, (Field Name)
().
(Size) (Dec).
(Size). , . .
, .
1. C++ Builder
27
,
. SQL-.
Database Desktop .
, StoreNo - ( Size),
. , ,
.
. , .
, ,
, (Borrow Struct).
, Create
Table Borrow Struct. Select Borrow Table,
Windows . (Alias), , .
(Open). Create
Table ,
. ,
dBASE Interbase. , ,
.
*.db *.dbf,
. Alias Select Borrow Table
None. ,
.
. 1.8.
28
Create Table )
. , SQL !
. 1.8.
. , ,
. Paradox .
(Referential integrity), (Secondary indexes),
. ,
SQL. SQL Explorer.
, , -|
,
SQL Explorer Database Desktop . ,
.
C++ Builder ,
SQL Explorer, a Database Desktop
, , .
, .
*.db * dbf ,
(Alias). .
, Database Desktop . ,
(QBE Query By Example), , , , . Database Desktop.
, , ,
Database Desktop, SQL Explorer.
. ,
, , . ,
, .
, , .
, C++ Builder 6. SQL
Explorer Database Desktop ,
. , , ,
. ,
.
BDE
BDE
liable
, ,
TDataSource
TField
Master/Detail
, .
,
, .
, :
- ,
,
.
,
BDE. BDE
Borland. BDE API,
, , .
BDE
. . (FoxPro, dBASE, Paradox,
) Microsoft Access
(Native) . , BDE .
. , SQL
Links, (Interbase, DB2, Oracle,
Informix, MS SQL Server Sybase). ODBC, BDE ( ,
ODBC).
30
BDE.
, , C++ Builder . , : BDE
C++ Builder . ,
(Data Controls) VCL BDE. .
, BDE . BDE
,
. , ,
BDE, . , ,
. , . ,
, , SQL-.
1C. ,
,
BDE.
, BDE . BDE, , . ,
. , , . . BDE
, , .
BDE , Borland
.
,
BDE. . , , BDE . -,
, ,
. BDE . .
BDE,
, .
.
-
, - , - . , . Database
Desktop Paradox 7.
(. . 2.1):
1. Field Name CategoryNo, Type Autoincrement (+), Key * .
2.
31
. 2.1. Category
, . 2.1,
, Big
Computer. , .. .
Autoincrement (
+). ,
Paradox.
CategoryNo ,
. Autoincrement
.
CategoryNo. , .
Post ( ) SQL
Explorer.
CategoryNo , Key. (*).
, Key ,
. Paradox
, <Primary>. , , (Secondary Indexes).
(Alpha). Category 25 , Description 50
. Category , Required Field.
,
(Validity Checks).
. - , -
32
, ,
.
Table properties Table Language Modify. Hi
,
Paradox ,
Paradox Cyrr 866. . Database Desktop, ,
. SQI
Explorer .
, , . , ,
. ,
(Paradox, dBASE, FoxPro) , . , SQL Explorer
STANDARD. DEFAULT DRIVER PARADOX (
), , Category (, D:\Datd).
- (, MyData) ( Apply
Object).
Category .
SQL Explorer. MyData ( ) Category.
SQL Explorer Data. , ,
. 2.2. , ( ). Insert
record ( +), Delete record ( -),
Post edit ( ).
1;
2
'
5 .
7
8
9.
10
11 '
t?
! , ,
Intel AMD
Intel. Amd VIA
DIMM. DIMM DDR RlMM
Radeon GeForce
- -
Fujitsu, Samsung Western Digrtel
, , ..
, , CD-ROM
, ,
. 2.2. Category
2.
33
,
. C++ Builder ()
SQL Explorer. MyData,
Category. : TDBGrid ()
() viTDataSource ( ). , .
, . Active true. ,
. ,
. 2.3. ,
TDBGrid .
, . , TDBGrid ?
TDBGrid .
DataSource. ( ),
DataSourcel TDataSource, .
DataSourcel, , DataSet
Table]. DatabaseName Tablel
MyData, TableName Category.db. .
- TDBGrid
Active true.
1
i
2
3 Intel AMD
. 2.3.
C++ Builder
(, TDBGrid) .
DataSource,
DataSourcel, DataSet,
Table?. , Tablel,
DatabaseName TableName. ,
.
, (Data Controls), TDBGrid
TDBEdit, .
2 . 319
34
, TDataSet (
). ,
Database TableName. TDataSet TQue,
() TStoredProc ( ).
, ,
, , Heni
, , , :
, . .
TDataSource,
(, TQuery TStoredProc)
(TDBGrid, TDBEdit .). , <
, ,
.
TDataSet TQuery, TDataSource, TDatabase, TFiek
,
, BDE.
C++ Builder , !
BDE. Borland ^
BDE, Data Access <
BDE .
TDataSet, !
, . TDataSet , .
. TDataSet , , , , , (. . ).
, , . . ,
. TDataSet
.
TDataSet,
,
. .
, - , : (Delete Table), (Rename Table),
(Update Table Definition), SQL Explorer (Explore).
(,
) , . , , . ,
TDataSet
(, TQuery, TStoredProc), , ,
. TDataSet,
(, TQuery, TStoredProc).
2. BDE
35
.
( ). Active
- TDataSet true,
. false () . , , . , ,
().
, DatabaseName TableName ( ), Active false.
Active
, . ,
Category , , , .
Active true , , . ,
,
. , .
Active :
false,
.
Active Open Close.
Active TDataSet :
if(Tablel->Active)
else
ShowMessage("Ha6op !");
ShowMessage(" !");
Active / . , ,
. ( TButton
Standard) (Name) DeactButton (Caption) Deactivate.
OnClick :
Tablel->Active=!Table1->Active;
if(Tablel->Active) DeactButton->Caption="Deactivate";
else
DeactButton->Caption="Activate";
: Active . , .
. Status,
OnClick , . , -
36
Deactivate, ,
Status (. . 2.4).
/ <
Open Close. .
void
void
fastcall Open(void);
fastcall Close(void);
Active. Open Active true, Close
false. , OnClick DeactButton
:
if(Tablel->Active)
{
Tablel->Close() ;
DeactButton ->tion="Activate";
}
else
{
Tablel->0pen();
DeactBut ton->Caption="Deactivate";
}
, Active
, Open Close .
1 ;9
2-
' :
3'
' -1!""
*"!"!^.
; -" .I^fio^:aeHM*'0'TXjjt#?{'' " j, DIMM. DIMM DDR RIN-f^
' ":/
^'
. 2.4. Active
DatabaseName TableName. Exclusive, Paradox dBASE .
.
DatabaseName
. , .
( dBASE, FoxPro, Paradox).
DatabaseName , . ,
2.
37
MyData, Category
, DatabaseName
D:\Data ( , Category).
; , , TableName,
. DatabaseName ,
: dBASE, FoxPro, Paradox. ,
.
, ,
, ( ). , .
DatabaseName TableName . :
property AnsiString DatabaseName =
{read=FDatabaseName, w r i t e = S e t D a t a b a s e N a m e } ;
property AnsiString TableName =
{read=FTableName, write=SetTableName};
,
DatabaseName TableName. ,
.
Tablel->Active = false;
Tablel->DatabaseName = "MyData";
Tablel->TableName = "Category";
Tablel->Active = true;
Tablel->Active = false;
Tablel->DatabaseName = "D:\Data";
Tablel->TableName = "Category";
Tablel->Active = true;
,
. ,
, .
Items
,
. ,
, Big
Computer. , Category.
Database Desktop.
Paradox 7 :
Q ItemNo. () Autoincrement.
Key, .
Q Item. () Alpha, (Size) 50.
. Required Field, .
38
. 2.5. Items .
Items Category. Table properties ( )
Referential Integrity Define.
, .
2.
39
, .. ,
(
).
Items Category,
Items Category. Table properties
Dependent tables ( ). ,
Items.db , Category.
, Items , , .
Table properties Secondary Indexes.
, Category.
.
40
, \
Item, . >
Define Define Secondary Index (Fields) Item. ,
(Indexedfields) .
. - ItemNDX(cM. . 2.5).
, ,
, , Category
Item. , - ,
.
Data Items Database
Desktop. Items , SQL Explorer Data. , , Description, . ( ItemNo,
) .
Category , CategoryNo
Category.
Items, ,
Data.
. (, , ) .
TDBNavigator .
TDBNavigator, , Form] TTable, TDataSource TDBGrid
, .
Items Active true.
TDBNavigator. , ,
( Data Controls), DataSource.
TDBNavigator TDataSource.
.
, TDBNavigator,
SQL Explorer, .
( ).
, , (. . 2.7):
(First), (Prior), (Next), (Last).
,
. 2.7
Items .
- , .
VisibleButtons.
2. BDE
41
. . false,
.
, , .
1;SamsungML-4SQO
'
3 Epson EFt-590QL
:
4 CanonLBP-810
5 Brother HL-1 240 Mono Laser
6 Epson AcuLoserCIQOO
7 Epson AcuLsssrC200D
B:HPLaserJet1000w
10:HP Laser JetlZZG
11 HP LaseiJet 3200
12:HP Laser JelZZQG
13 -Epson Stylus Color CJOSX
HJEpsor. Stylus Color DUX
15 lEpson Stylus Color C60
. 720 dpl.
-A1. . 2883x72^
' -
. 2.7. TDBNavigator
,
:
//
//
. MoveBy Distance . Distance , .
(). , MoveBy(1) Next{),
MoveBy(-l) Prior(). MoveBy() ,
. Distance.
, ,
, , .
Bof (Begin of file) Eof (End of file) , . Bof
true :
U ;
Q First ( ,
);
42
Prior, ;
Q SetRange .
/ false.
Eof, true :
G ;
G Last;
Next, ;
1_1 SetRange .
/ Eof . , , .
(, AfterScroll
TTable) / Eof, , ,
.
, ,
(Bof = = true + Prior) (Eof ' = = true +
Next)
.
Bof Eof TTable, . ,
VCL TPanel.
TPanel , Caption.
,
, Bevellnner bvRaised, BevelOuter bvLowered.
, , ( TButton).
Name ( ): BFirst, BPrior, BNext BLast,
Caption First, Prior, Next Last .
Tag 1 (BFirst), 2 (BPrior), 3 (BNext) 4 (BLast)
, ,
. .
TEdit, TButton.
BMoveBy ( Name) (Caption) MoveBy.
TEdit Text. ( ):
EPlan EReally. . , ,
TEdit
(TLabel). (Caption): Bof Eof ( ).
TEdit Text : EBofu EEof. , ,
.
( TDBGrid(DBGridl)),
TDataSource (DataSourcel) TTable (Tablet). , . Table 1 Items, Active
false. , . 2.8.
2.
43
~% McveByj j
. 2.8. ,
Bof Eof
, ,
. BFirst,
Events OnClick. C++ Builder
BFirstClick. OnClick (
). :
void
fastcall T F o r m l : : B F i r s t C l i c k ( T O b j e c t *Sender)
TButton * Temp;
Temp=dynamic_cast<TButton *>(Sender);
if(Temp)
switch(Temp->Tag)
case 1:
Tablel->First(); break;
case 2 :
Tablel->Prior(); break;
case 3:
Tablel->Next(); break;
case 4:
Tablel->Last(); break;
BFirst->Enabled=!Tablel->Bof;
BPrior->Enabled=!Tablel->Bof;
BNext->Enabled=!Tablel->Eof;
Blast->Enabled=!Tablel->Eof;
Temp TButton.
TButton Sender. ,
44
(, ).
, :
. , !
Tag . ,
Tag 1 4. ,
, . !
/ 0/ .
/, BFirst BPrior , !
Eof BNext BLast. Bofvam Eof '
false, .
BMoveBy
EPlan EReally.
, EPlan BMoveBy, ,
,
EReally. , OnClick
BMoveBy :
void
{
}
StrToIntDef
EPlan->Text AnsiString . StrToIntDef ,
. , MoveBy,
AnsiString EReally.
EPlan
Enter. , OnKeyPress EPlan :
void
{
}
, ,
(. . , ASCII)
, . , Enter
(VK_RETURN ,
Enter), BMoveBy NULL.
/ / , ,
/ Eof TTable.
, A/terScroll TTable. ,
, , ( ,
). AfterScroll :
2.
void
45
EBof->Text="true";
EBof->Text="false";
EEof->Text="true";
EEof->Text="false";
( NavMethods) .
.
2.1 2.2.
2.1. NavMethods
#ifndef UnitlH
#defme UnitlH
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBCtrls.hpp>
#include <OBGrids.hpp>
#include <DBTables.hpp>
#include <ExtCtrls.hpp>
#include <Grids.hpp>
class TForml : public TForm
published:
// IDE-managed Cdmponents
TTable *Tablel;
TDataSource *DataSourcel;
TDBGrid *DBGridl;
TButton *BFirst;
TButton *BPrior;
46
TButton *BNext;
TButton *BLast;
TPanel *Panell;
TPanel *Panel2;
TButton *BMoveBy;
TEdit *EPlan;
TEdit *EReally;
TPanel *Panel3;
TEdit *EBof;
TLabel *Labell;
TLabel *Label2;
TEdit *EEof;
void _ fastcall FormCreate(TObject *Sender) ;
void _ fastcall BFi rstClick(TObject *Sender) ;
void _ fastcall BMoveByClick(TObject *Sender);
void _ fastcall EPlanKeyPress(TObject *Sender, char &Key)
void _ fastcall TablelAf terScroll (TDataSet *DataSet);
private: // User declarations
public:
// User declarations
_ fastcall TForml(TComponent* Owner);
extern PACKAGE TForml *Forml;
//-- ........ #endif
2.2. NavMethods
#include <vcl.h>
#pragma hdrstop
#include "Unitl.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForml *Forml;
_fastcall TForml : :TForml(TComponent* Owner)
: TForm(Owner)
2.
47
TButton * Temp;
Temp=dynamic_cast<TButton *>(Sender);
if(Temp)
switch(Temp->Tag)
/
case 1:
Tablel->First(); break;
case 2:
Tablel->Prior(); break;
case 3:
Tablel->Next(); break;
case 4:
Tablel->Last(); break;
BFirst->Enabled=!Tablel->Bof ;
BP r i or ->Enabled=! Table l->Bof;
BNex t->Enabled=! Table! ->Eof;
Bias t->Enabled=! Table!- >Eof ;
EReally->Text=IntToStr
(Tablel->MoveBy(StrToIntDef (EPlan->Text ,0)
else
if (DataSet->Eof)
else
EBof->Text="true";
EBof->Text="false"
EEof->Text="true";
EEof->Text="false"
(Fields)
Fields.
TFields , TField.
TField . TField
, . TField
, Fields.
48
, TFields ,
, .
TFields:
TFields . ,
(, TCIientDataSet),
.
AggFields.
TFields , (TField). :
TField* operator [] (int Index) { return Fields[Index] ; }
TField*
fastcall FieldByNumber(int FieldNo);
TField*
fastcall FieldByName(const AnsiString FieldName);
[] . (
!).
, . ,
Items 0 ItemNo, 1 Item, Price 5. Count 6.
: ItemNo 0,
Item \ ..
. (Fields Editor), .
, ,
. , ,
Description , ,
. ,
,
Add fields. , Description ( , Ctrl) . ,
Description.
2.
49
, .
, /7 FieldByNumber. ,
. FieldByNumber , , [] .
, , . , ( TLabel),
TListView, . . Items MyData. , , ( Description ). TListView.
,
: Index, Fieldsflndex] FieldByNumber [Index].
, ViewStyle
vsReport. OnCreate :
void _ fastcall TForml: :FormCreate(TObject *Sender)
{
Tablel->0pen();
Labell->Caption=
" Items " +
IntToStr(Tablel->Fields->Count)
+ " : " ;
TListltem *Temp;
for(int i=0;i<Tablel->Fields->Count;i++)
Temp=ListViewl->Items->Add() ;
Temp->Caption=i ;
Temp- > Subl terns ->Add (Table l->Fi eld s->Fi elds [i] ->FieldName) ;
Temp- >SubI terns ->Add (Table l->Fi elds ->FieldByNumber (i+1) ->FieldName) ;
.
[] FieldByNumber (. . 2.9).
Count TF/e/ds ,
. , ,
Items, Tab/e7->F/e/ds->Count 5,
. F/eldCount
(, TDataSet).
, ,
FieldByName.
TField, . ,
50
.
FieldByName,
Tablel->FieldByName("Item") '
Tablel->FieldByName("Description")
// Item
// Description
Hems cc
::
Item temNo
' Category
* Jridex .. _
. Price
: Qeacriptipn
2
4
5
l(
rr 4 0
?. '' '
Iten
: Category
.1 Description
i Index
: Price
. 2.9. FieldByNumber ,
,
,
,
. BDE . . ,
, , .
:
void
fastcall ApplyRange(void);
void
fastcall CancelRange(void);
void
fastcall EditRangeEnd(void);
void
fastcall EditRangeStart(void);
void
fastcall SetRange(const System::TVarRec * StartValues,
const int StartValues_Size, const System::TVarRec * EndValues,
const int EndValues_Size);
void
fastcall SetRangeEnd(void);
void
fastcall SetRangeStart(void);
, , TDataSet.
,
() , .
Q ,
. IndexFieldNames,
IndexName. IndexFieldNames AnsiString, , .
IndexName, , ,
. , ,
, .
Q , .
2.
51
Table1 ->DatabaseName="MyData";
Tablel->TableName="Items.db";
Tablel->IndexFieldNames="Category";
Tablel->0pen();
Tablel->SetRangeStart();
Tablel->FieldByName("Category")->AsInteger=3;
Tablel->SetRangeEnd();
Table!->FieldByName("Category")->AsInteger=5;
Tablel->ApplyRange();
SetRangeStart SetRangeEnd ApplyRange SetRange, . SetRange-
( ) . :
Tablel->DatabaseName="MyData";
Tablel->TableName="Items.db";
Tablel->IndexFieldNames="Category";
Tablel->0pen() ;
Tablel->SetRange(OPENARRAY(TVarRec,(3)), OPENARRAY(TVarRec,(5)));
OPENARRAY ,
, .
, OPENARRAY(TVarRec,(3))
SetRange, OPENARRAY(TVarRec,(5)) - .
/ Open/Array Object Pascal,
.
, C++ , VCL,
Object Pascal, .
OPENARRAY ARRAYOFCONST
Borland C++ Builder.
. , ,
TDBGrid, TDataSource,
Items , . ,
. (TPanel).
(TButton).
: BPriorCat, BNextCat, BPriorRec, BNextRec, : Prior Category, Next
Category, Prior Record, Next Record. (TEdii),
52
iLJ
. 2.10. ApplyRangeDemo
. , Forml, , :
long int C a t ;
Cat
. OnCreate
:
2.
53
Unit 1. :
void
Tablel->SetRangeStart();
Tablel->FieldByName("Category")->AsInteger=Cat;
Tablel->SetRangeEnd();
Tablel->FieldByName("Category")->AsInteger=Cat;
Tablel->ApplyRange();
ECat->Text=IntToStr(Cat);
BApply->Enabled=false;
BCancel->Enabled=true;
}
SetFilterCat , .
Cat 0, .
. SetFilterCat ECat
Apply Range Cancel Range. ,
TDBGrid ,
. Aslnteger TField Integer. Aslnteger TField
, .
.
KeyExclusive boo/;
.
,
. ,
, 4 5.
Tablel->SetRangeStart();
Tablel->FieldByName("Category")->AsInteger=3;
Tablel->KeyExclusive=false;
Tablel->SetRangeEnd();
Tablel->FieldByName("Category")->AsInteger=5;
Tablel->ApplyRange();
, , OnClick. BPriorCat OnClick
Tablel->First(), BNextCat Tablel->Last(),
BPriorRec BNextRec Tablel->Prior() Tablel->Next().
, (. . / Eof true) ,
.
OnClick (BPriorCat, BNextCat, BPriorRec BNextRec)
54
Enabled
,
, , .
OnClick ,
. , ^
, ECat.
. . ,
.
,
,
. 2.3 2.4.
2.3. ApplyRangeDemo
//
#ifndef UnitlH
#define UnitlH
//
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <DBTables.hpp>
^include <Gn'ds.hpp>
#include <ExtCtrls.hpp>
//
class TForml : public TForm
{
published:
// IDE-managed Components
TDBGrid *DBGridl;
TTable Tablel;
TDataSource *DataSourcel;
TPanel *Panell;
TButton *BPriorCat;
TButton *BPriorRec;
TButton *BNextCat;
TButton *BNextRec;
TPanel *Panel2;
TEdit *ECat;
TLabel *Labell;
TButton *BApply;
TButton *BCan.cel;
void fastcall FormCreate(TObject Sender);
void fastcall BPriorCatClick(TObject *Sender);
void fastcall BNextCatClick(TObject *Sender);
void
fastcall BNextRecClick(TObject *Sender);
void
fastcall BPriorRecClick(TObject *Sender) ;
void fastcall BCancelClick(TObject *Sender);
void fastcall BApplyClick(TObject *Sender);
2.
//
#endif
2.4. ApplyRangeDemo
#include <vcl.h>
#pragma hdrstop
#include "Unitl.h"
#pragma package(smart_ini t)
#pragma resource "*.dfm"
TForml *Forml;
long int Cat;
_fastcall TForml: :TForml(TComponent* Owner)
: TForm(Owner)
55
56
2.
57
void
Tablel->SetRangeStart();
Tablel->FieldByName("Category")->AsInteger=Cat;
Tablel->SetRangeEnd();
Tablel->FieldByName("Category")->AsInteger=Cat;
Tablel->ApplyRange();
ECat->Text=IntToStr(Cat);
BApply->Enabled=false;
BCancel->Enabled=true;
void
Cat=0;
Tablel->CancelRange();
BApply->Enabled=true;
BCancel->Enabled=false;
ECat->Text="All";
BPriorCat->Caption="Fi rst Record";
BNextCat->Caption="Last Record";
void
Cat=StrToIntDef(ECat->Text,0);
if ((Cat < 1) || (Cat > 12)) Cat=l;
SetFilterCat(Cat);
BPriorCat->Caption="Prior Category";
BNextCat->Caption="Next Category";
Filter, Filtered
FilterOptions. TBDEDataSet, TDataSet . Filter
Filtered , , , .
.
.
Filter , , . -
58
:
=.
, Category=3, Filter, ,
, 3. , , ,
. , , .
, : [ ].
:
(<>), (>), (<), ..
, Filtered
true. ,
. , Filtered
false.
FilterOptions, . FilterOptions FilterOption: foCaselnsensitive KfoNoPartialCompa, .
. FilterOptions foCaselnsensitive,
.
FilterOptions foNoPartialCompare . foNoPartialCompare , . , ,
Item- 'S*' , Item
S. FilterOption ,
true .
Filter Filtered . , , , (TDBGricf), TDataSource, ,
Items. , .
2.11, . (
TEdit) ECriteria, (TCheckBox) CBCaselnsensitive CBNoPartialCompare . (TButton) : Apply BCancel.
^rtteria Stfjpg: & ^
'**
ttemNo
"
r NO *
CwcsiRterj
|
3 Epson EPL-5900L
6 Epson AcuUasef C1000
7 EpsonAcuLaserCZDOO
3 Epson Stylus ColorCSDSX
4 Epson Stylus ColorCMQUX
5 Epson Stylus Color C60
6 Epson Stylus Color C70
7 Epson Stylus ColorCfiO
Epson Stylus Photo B1Q
jcafcij.!^ |''s *]
A^ IJJ4,
A4;>."'l
A4.-.',;:;^
A4 . ,
:
A-f ,.|
A1 v.:^
:
A4 "-
A4..;.|
'A4 "'-&
JLJJ
. 2.11. Item
^
Filter Filtered
2.
59
OnCreate OnClose :
void
{
fastcall TForml::FormCreate(TObject
*5ender)
Tablel->0pen();
void
{
}
, , :
Tablel , .
OnClick BApply BCancei.
void
{
Tablel->Filter=ECriteria->Text;
if(CBCaseInsensitive->Checked)
Table1->FiIterOptions foCaselnsensitive;
else Tablel->FilterOptions foCaselnsensitive;
if(CBNoPartialCompare->Checked)
Table1->FiIterOptions foNoPartialCompare;
else Tablel->FilterOptions foNoPartialCompare;
Tablel->Filtered=true;
}
void
{
}
BCancei Filtered false', .
BApply
, ECriteria, ,
ECriteria, Filter, ,
CBCasefnsensitive CBNoPartialCompare,
FilterOption. , Filtered
true.
! ,
.
. . 2.11 Items, Item.
, Case Insensitive , No Partial Compare
. . . 2.11 ,
Item sam Sam (
) (,
).
60
OnFilterRecord . TDataSet
:
,
. SetKey ( EditKey
GotoKey . :
2.
61
, .
, , , ,
. SetKey
, , , ,
. GotoKey ,
EditKey , ,
. GotoKey , , , .
, Item Items.
Tablel->IndexName="ItemNDX";
Tablel->SetKey();
Tablel->FieldByName("Item")->AsString=ESample->Text;
Tablel->GotoKey();
Tablel->IndexName="";
,
. , Items Item
ItemNDX. SetKey,
, Item ,
ESample. GotoKey
,
. .
, IndexName ItemNDX,
Item ,
ItemNDX ( ). , ,
, .
(. . ). , ,
, IndexName.
, ,
GotoKey GotoNearest. ,
.
. GotoNearest , , .
, GotoKey GotoNearest, . FindKey FindNearest. :
bool
void
( ), .
. , -
62
OPENARRAY ARRAYOFCONST.
FindKey FindNearest SetKey
, , . , ,
, :
Tablel->IndexName="ItemNDX";
Tablel->FindKey(OPENARRAY(TVarRec,(ESample->Text)));
Tablel->IndexName="";
Locate. TBDEDataSet ( ,
TDataSet) :
}
CBCaselnsensitive CBPartialKey . EField, ESample.
Lookup , ,
.
TBDEDataSet :
virtual System::Variant
fastcall Lookup(const AnsiString KeyFields,
const System::Variant SKeyValues, const AnsiString ResultFields);
Lookup , , .
2.
63
.
Locate (. ). AnsiString. ,
. , - Items,
, :
fastcall
fastcall
fastcall
fastcall
FindFirst(void);
FindPrior(void);
FindNext(void);
FindLast(void);
true
false .
OnFilterRecord , .
Filtered false.
. , OnFilterRecord,
.
Find... OnFilterRecord, . , TDBGrid, TTable TDataSource, .
Items
MyData.
(: EField ESample), (: Field Sample) (:
BFindFirst, BFindPrior, BFindNext, FindLast; , : Find First, Find
Prior, Find Next, Find Last; Tag, : 1,2,3, 4).
, . 2.12.
BFindFirst OnClick OnClick .
:
TButton* Temp=dynamic_cast<TButton *>(Sender);
if(Temp)
swi tch(Temp->Tag)
64
,
.
Sender TButton *, , ,
Tag, !
( ).
TDBGrid.
OnFilterRecord:
Accept=(DataSet->Fields->
FieldByName(EField->Text)->As5tring.AnsiPos(ESample->Text)
0) ;
,
EField. AsString
AnsiString. AnsiPos AnsiString
, , ESample, !
. , AnsiPos , (
Accept true, Find...
, true. FindPrior FindNext nonet
, .
^5
Hum
tewnNo
r|
jttem
:JFC-PGA
-*.-
.-
*SfjlS
V.FiBdtosr;;::.!
---:--'
""
'
'
FBiti^fe<l
."-.
"
:|
jCetegor*}
'
>
LJ
, ...
;i
. :-?-<
:,.; .,.;;:.;j;,^
. 2.12. ,
FindFirst, FindPrior, FindNext FindLast
-, , FindFirstDemo, . . 2.12
Item 'FC-PGA'. BFindPrior BFindNext,
, , . BFindFirst BFindLast , , .
FindFirstDemo 2.5 2.6.
,
, .
2.
65
, ,
, , , . .
, , .
2.5. FindFirstDemo
//
------
...............................
- ............................
#ifndef UnitlH
#defme UnitlH
// ------ ......................... - ..... -------- ............. -------#include <Classes . hpp>
#include <Controls . hpp>
#include <5tdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <DBTables.hpp>
#include <Grids.hpp>
// ..... - ..... - ............ - ............ ---- ............... ---- ......
class TForml : public TForm
{
_ published:
// IDE-managed Components
TDBGrid *DBGridl;
liable "Tablel;
TDataSource *DataSourcel;
TEdit *EField;
TLabel *Labell;
TEdit *ESample;
TLabel *Label2;
TButton *BFindFirst;
TButton *BFindLast;
TButton *BFindPrior;
TButton *BFindNext;
void _ fastcall BFindFi rstClick(TObject *Sender);
void _ fastcall TablelFilterRecord(TDataSet *DataSet,
bool &Accept) ;
void _ fastcall FormCreate(TObject *Sender) ;
void _ fastcall FormClose(TObject *5ender, TCloseAction &Action);
private: // User declarations
public:
// User declarations
_fastcall TForml(TComponent* Owner);
extern PACKAGE TForml *Forml;
/ / ----- .................. #endif
2.6. FindFirstDemo
#include <vcl.h>
#pragma hdrstop
3 . 319
66
#include "Unitl.h"
#pragma package(smart_ini t)
#pragma resource "*.dfm"
TForml *Forml;
_fastcall TForml : : TForml (TComponent* Owner)
: TForm(Owner)
TForml: : FormClose(TObject
*Sender,
TCloseAction
Tablel->Close();
. , . IndexName IndexFieldNames.
2. BDE
67
, , ,
, , , . , , , . (
), .
, . TQuery.
, ,- , . , , ,
. DeleteTable
.
, TDataSet .
, TDataSet, :
void
fastcall Append(void);
void
fastcall AppendRecord(const System::TVarRec * Values,
const int Values_5ize);
void
fastcall Delete(void);
void
fastcall Edit(void);
HIDESBASE void fastcall Insert(void);
void
fastcall InsertRecord(const System::TVarRec * Values,
const int Values_Size);
TBDEDataSet :
virtual void
virtual void
fastcall Cancel(void);
fastcall Post(void);
,
, , , .
( Cancel)
( Post). .
Insert , . dslnsert, . ,
, (. .
), Post.
Cancel.
Insert,
Post ( ),
.
Q Paradox, ,
.
Q Paradox ,
.
InsertRecord ,
Autoincrement Required Field (
). ,
. , ,
, ,
, .
Append AppendRecord ,
Insert InsertRecord ,
. Delete, . , . , .
.
Edit (dsEdif). , .
Post. Cancel , ( dsBrowse). Index .
Tablel->Edit();
Tab!el->FieldByName("Index")->AsString=EIndex->Text;
Tablel->Post();
Insert, Append Edit CheckBrowseMode
, .
, , . : Beforelnsert, BeforeEdit, BeforeDelete,
BeforePost, BeforeCancel, Afterlnsert, AfterEdit, AfterDelete, AfterPost, AfterCancel.
, . , Delete BeforeDelete, , , AfterDelete. , ,
.
2.
69
Before
- , . , , , . After
- , . BeforePost. , .
, .
, .
, , ,
Cancel. Abort, ( ), . No, Abort,
, Cancel. ,
, .
case IDCANCEL:
{ AbortQ; break; }
case IDNO:
{ DataSet->Cancel() ; AbortQ; break; }
, . , . .
. : Cannot modify a read-only dataset
( ). ,
CanModify.
. true, ,
. ,
CanModijy true, ,
SQL . .
,
,
(
).
. Readonly true;
CanModify //. Readonly
, , ,
CanModify.
70
TDataSet Modified.
, , .
, ,
.
Bookmark. !
TDataSet :
property
AnsiString
wri te=SetBookmarkStr};
Bookmark
{read=GetBookmarkStr,
,
Bookmark AnsiString. , AnsiString,
Bookmark. , BSaveBookmark
BRestoreBookmark , TDBGrid, TDataSource TTable, Items
MyData.
. ,
, .
BRestoreBookmark. AnsiString (, MyBookmark),
OnClick :
2. BDE
,
GetBookmark.
TBookmark. GotoBookmark.
GetBookmark FreeBookmark,
, GetBookmark.
Bookmark,
, BGetBookmark
BGotoBookmark. , Forml,
:
TBookmark MyTBookmark;
OnClick BGetBookmark BGotoBookmark
:
void
{
}
void
{
}
BGotoBookmark
FreeBookmark , MyTBookmark
GetBookmark. MyTBookmark
NULL. , ,
BGetBookmark . OnClose :
if(MyTBookmark) Tablel->FreeBookmark(MyTBookmark);
,
MyTBookmark. NULL, ,
FreeBookmark.
, ,
.
BookmarkValid, TBDEDataSet :
virtual bool
, , -
. , (unidirectional)
72
TDataSource
, ,
. , Post ,
,
: Dataset not in edit or insert mode (
). , Post, ,
.
State.
TDataSet :
2. BDE
73
74
TDataSet (, , :
, ).
, ;
TDBGrid , TDBGrid,
(dsEdit). (
- Options TDBGrid) dgAlwaysShowEditor
Enter F2, ;
.
, AutoEdit
TDataSource true. AutoEdit false,
Edit.
.
TDataSource, ,
: IsLinkedTo Edit. Edit
TDataSource , . AutoEdit. true, . (dsBrowse),
Edit . , Edit TDataSource
,
.
IsLinkedTo , TDataSource
TDataSet. .
TDataSource. : OnDataChange, OnStateChange OnUpdateData.
TNotifyEvent, OnDataChange :
typedef void
OnDataChange
, , (, ). ,
Field NULL. To Field , .
.
, , , ,
.
OnUpdateData ,
, BeforePost. .
, , OnStateChange
, , . -
2. BDE
75
, , ,
.
OnStateChange,
ModifyRec,
. IDE C++ Builder TStatusBar.
( Align alBottom). SimplePanel
TStatusBar true SimpleText .
OnStateChange :
void
, .
.
.
,
.
TField
TField (,
..). , . TField , , ,
C++ Builder.
, 2.1.
TADTField
TObjectField.
ADT (Abstract Data Type).
ADT (), . ADT.
TAggregateFi eld
TField. .
.
, , .
TArrayField
TObjectField.
. .
(, ),
(, ADT).
TAutoIncField
TInteger Field, ,
,
TNumericField. .
TBCDField
TBinaryField
TField.
.
TBlobField
TBooleanField
TField.
.
TBytesField
TBinaryField.
Byte.
TCurrencyField
TFloatField, TNumericField.
Currency.
TDataSetField
TObjectField.
, ,
(nested) .
TDateField
TDateTimeField.
, .
2.
77
TDateTimeField
TField.
, .
TFloatField
TNumericField.
, .
TFMTBCDField
TNumericField.
- BCD (Binary
Coded Decimal). TFMTBCDField TBCDField . C++ Builder 6.
TGraphicField
TBlobField.
, .
TGuidField
TStringField.
,
(GU1D Globally Unique Identifier).
TIDispatchField
TInterfaceField.
, IDispatch.
TIntegerField
TInterfaceField
TField. ,
, (lUnknown).
TLargelntField
large integer.
TMemoField
TBlobField.
MEMO.
TReferenceField
TObjectField.
, .
TSmalllntField
TIntegerField, , , TNumericField.
small integer.
TSQLTimeStampField
TField.
Date/Time dbExpress. C++ Builder 6.
TStringField
TField.
.
TTimeField
TDateTimeField.
, .
TVarBytesField
TBytesField, ,
, TBinaryField.
.
TNumericField.
TNumericField.
78
TVariantField
TField.
Variant.
TWideStringField
TStringField.
WideString.
TWordField
TInteger Field,
TNumericField.
Word.
TField .
, , , ,
, ,
. TField
-
. , -
. , , TField,
, TStringField, FixedChar Transliterate,
.
- TField: . , ,
.
, TField
TField . , , .
C++ Builder.
TField . As , .
, .
.
2.
79
.
Value, DisplayText Text. Value / ( ) .
. , TCurrencyField, Value Currency. DisplayText Text AnsiString
, . Text . Text
DisplayText OnGetText ,
.
DataType FieldKind .
DataType . DataType
TFieldType. 2.1 - TField. , TIntegerField
ftlnteger, .. FieldKind
TFieldKind:
fkData , .
jkCalculated . OnCalcFields.
fkLookup . .
JklnternalCalc , ,
/kData. ,
SQL, , BDE , RequestLive
true.
jkAggregate .
. Calculated, Lookup,
LookupCache, LookupDataSet, KeyFields, LookupKeyFields, LookupList LookupResultField.
true Calculated , , . . OnCalcFields . . .
AutoGenerateValue. ,
, . ,
. ( Post)
. AutoGenerateValue.
, ,
. AutoGenerate Value
TAutoRefreshFlag: arNone ( ), arAutoInc
( ), arDefault ( ).
, AutoGenerateValue,
, .
80
DefaultExpression.
, SQL, -|
. ,
, , 'No Item' '15:45'. *
DefaultExpression, , ;
,
.
TField ,
(). ,
. CustomConstraint, ImportedConstraint
ConstraintErmrMessage HasConstraint. CustomConstraint , , . , CustomConstraint,
, ConstraintErmrMessage.
ImportedConstraint , . , ImportedConstraint
. . ImportedConstraint
, , , , .
, , ImportedConstraint,
,
. ConstraintErrorMessage
, .
HasConstraint .
true, .
, : CustomConstraint, ImportedConstraint
DefaultExpression.
FieldKind - fkData, FieldName
,
.
TField
. Islndex true, ()
. IsNull true, . EditMask TEditMask ( AnsiString)
.
TEditMask
C++ Builder.
TField .
BDE. , ,
Assign Clear. Assign Value .
. , TablelDateO->Assign(TablelDatel) DateO Table 1 Datel . ,
Date. TablelDescription->Assign(Memol
->Lines) Description Tablel, Memo, -
2. BDE
Memol, . Clear ,
Value NULL.
TField , .
OnChange, OnGetText, OnSetText OnValidate. OnChcmge
, .
,
. OnChange OnValidate,
. OnChange , ,
. OnChange , .
OnValidate .
, . OnValidate
. , ( throw).
OnChange .
OnGetText OnSetText :
typedef void
fastcall (
typedef void
fastcall (
OnGetText DisplayText
Text TField. ,
, . TDBGrid OnGetText ,
. Sender ,
, Text
AnsiString.
, Text
. , TDBGrid,
OnGetText,
. , OnGetText, Text.
, Text AsString .
OnGetText -,
:
void
Text=Sender->AsString;
82
OnGetText
DisplayText. , , Text
.
- .
OnSetText , Text
. Text,
const, Text .
Text . ^
OnGetText - , OnSetText
.
.
(Dynamic fields),
(Persistent fields).
, .
. . , . ,
, .
.
,
. .
, - ,
. ,
.
FieldDefs
. TFieldDefs
, . FieldDefs
, , ,
. FieldDefs , (Calculated
Fields). (
IndexDefs),
.
(Persistentfields)
, (Fields Editor). , ,
, , . ,
, , .
, , .
TField ( )
.
2.
83
, ( ) . , ,
. ,
. , .
, .
, ,
. ,
,- , .
, , , , .
, , .
tern
temMo
<JJ
Category
jfcKn
328 HUBCompexPS <ndex
329 HUBHPPraCun Price
!CofX>.*l
330 ;
331 HUBEP-ai6DX332 Mel EthE
333 Intel EthE
33-1 Intel Ethe Express Pro/1 Ods Ptl Server Adapt
335 Intel Pro/1DOS Dual Port Server Adapter
336 imel Pro/ COOT
337 HUB Intel Stainda one Managed Switch
:'
. 2.13.
, , . , - TDataSet (, TQuery),
Fields Editor. ,
(. . 2.13).
. , Add fields Add all fields.
, . .
New field
. . : (Data), (Calculated)
(Lookup). (, ClientDataSet),
(Aggregate) IntemalCalc.
. (Data), . ,
84
, ,
.
.
. , Name Fiel
Name. FieldName ,
, Name . HMCI
,
. , Tablelhem.
. ,
Table!->FieldByName(Item).
,
. ;
( ,
)
. , Item Items
TStringField, Price TCurrencyField. ]
,
, .
Delete.
(Attribute Sets). !
, SQL Explorer.
SQL Explorer,
. Associate attributes. , .
Dictionary SQL Explorer Attribute Sets,
.
, . ,
, , .. , , , . , Unassociate attributes.
,
.
- ,
: Save attributes, Save attributes
as Retrieve attributes. Save attributes ,
, , .
Save attributes as .
Retrieve attributes
.
, . .
2.
, ,
. ,
. ,
( ) TDBEdit,
, , TDBImage. ,
( Tlabel), .
, ,
.
.
(Calculated Fields)
-
(Calculated
Fields), .. , , . , , ,
, .
,
, .
.
.
OnCalcFields ,
. ,
,
, ,
. , , ,
Visible false.
OnCalcFields .->1-.
OnCalcFields
. , , . OnCalcFields :
Q , ;
Q ( dsEdif);
G (, ).
, AutoCalcFields true, OnCalcFields
(TDBGrid) .
,
, AutoCalcFields false,
.
, -
86
MyData, , .
. Database Desktop
Paradox 7. , 2.2.
2.2. Employees
(Field Name)
()
(Size)
EmployeeNo ()
Autoincrement (+)
LName ()
Alpha (A)
50
FName ()
Alpha (A)
20
MName ()
Alpha (A)
25
HireDate ( )
Date (D)
FireDate ( )
Date (D)
Description ()
Memo (M)
Photo ()
Graphic (G)
Birthday ( )
Date (D)
(Key)
*
240
2.
87
() ,
: Name ( ), Age (), Standing ().
(, ).
, New field , .
Name, (
_). String
Name Smalllnt Age Standing. Size 50
Name,
. Field type
Calculated. . 2.14 Standing.
. 2.14. Standing
Name, Age Standing
LName, FName, MName, HireDate Birthday. , FireDate,
( ).
Add fie Ids. . Visible
false, .
,
false Visible .
, OnCalcFields :
void _fastcall TForml: :TablelCalcFields(TDataSet *DataSet)
AnsiString FI.SI;
unsigned short yearl, yearO, month, day;
if (!TablelFName->IsNull)
FI=" " + (TablelFName->Value). SubString(0, 1) + "." ;
if((!Table!MName->IsNuU) && ( ! (FI . IsEmpty ()) ))
SI=" " + (TablelMName->Value) . SubString(0, 1) + "." ;
TablelName->Value=TablelLName->Value + FI + SI;
Date() .DecodeDate(&yearl, &month, &day) ;
(TablelBirthday->Value) .DecodeDate(&year0, &month, &day) ;
TablelAge->Value=yearl-year0;
(TablelHireDate->Value) .DecodeDate(&year0, &month, &day) ;
TablelStanding->Value=yearl-year0;
. 2.15. ,
Value Name
, . : i
, Name .
OnCalcFields (
Age Standing. ( Age)
, . ( Standing)
- .
Date, TDateTime. TDateTime DecodeDat
, .
OnCreate
:
void
fastcall TForml::FormCreate(TObject *Sender)
{
Tablel->0pen();
Tablel->Filtered=true;
}
.
. . 2.15
.
TDataSet TQuery. !
TQuery -.
2. BDE
(Lookup Fields)
(Lookup Fields)
.
.
,
, ,
. , Items Category,
Category. , - . ,
.
,
.
Category Items.
, ,
TDBGrid, TTable TDataSource, . , Tablel
Items MyData. Active Tablel true,
. Category.
(2) .
. ,
Tablel. Add all fields,
. , .
New field. , Field properties,
(Name) ( Category ,
CategoryName), () (Size) ( Category, String 25
).
Field type Lookup, ,
. Lookup definition
: Key Fields Dataset.
Key Fields , ,
. . Key Fields,
, . Category.
Dataset
TDataSet ( : Tablel Table!). ,
.
Tablel, , ( ). 2.
: Lookup Keys Result Field.
90
: Field ptoperties
: :
Type:.. '.'Sting
;
Field -
|CrtegoiyJome
^J Site:
|re
'
. 2.16. CategoryName
Lookup Keys ;
(Lookup DataSei). ,
Lookup Keys, , <
Key Fields. >
1
.
, Kt
Fields. CategoryNo.
Lookup definition Result Field.
, Result Fieh
,
. Category. . 2.1
New Field,
CategoryName.
Tablel , .
Category, ,
, Visible //.
CategoryName ,
Item. , :
. : DisplayLabt
CategoryName Category.
.
.
. 2.17.
1J
1 Samsung ML-4500
2 SamsungML-1210
3 Epson EPL-59QQL
A Canon LBP-81Q
5 Brother HL-1Z40 Mono Laser
e.EpsonAcuLossfCIOOO
7 EpsonAcuLaserCZQOO
8 HPLeserJetlCQQw
9 HPLeserJel1200
10 HP LaserJet 1220
11 HP LaserJet 3200
. 2.17. , Category
2.
91
CategoryName
, . , New field .
FieldKind JkLookup, Field type.
Lookup definition , , KeyFields,
LookupDataSet, LookupKeyFields LookupResultField. ,
, ,
, .
,
, . LookupCache.
true,
.
, .
, .
,
,
, .
, ,- /
(Master/Detail). :
, , , , . ,
(Master) , (Detail). -,
, , .
, . , ,
.
/
. . , ,
, .
.
TDBGrid, TDBLookupComboBox.
TDBLookupComboBox, TDBGrid. ,
TTable (Tablel 2) TDataSource (DataSourcel DataSource2).
DataSourcel DataSource2 Tablel 2 . Tablel
Category MyData, 2 Items . , Tablel
(Category), 2 , (Items).
92
__]
Swat
Descripsc
(tern
;
(Category JDescnpliorv .
*|
DfMM 64 Mb PC1 33. Infineon
5 1 69 pin. 54 bit
1
DIMM 64 Mb NCP
5 68 pin. 64 bit
DIMM 1 28 Mb PC! 33, POI original
5 60pm, 64 bit chip 'DIMM 1 28 Mb PC1 33, NCR
5 68 pin. 64 bit
DIMM 1 26 Mb PCI 33. Samsung original
5 : 63 pin. 5-1 bit 8 chip ..,;.
DIMM 1 28 Mb PCI DO. Transcend
5 rS16MLE?2V6XN.w
|
DIMM ?SG Mb PCI 33. Spectek
5 6 chips
DIMM 256 Mb PCI 33. M tec
5 68pm. 64 bit
.QIMM256MbPC133.PQI
5 68 pin. 54 bit
DIMM 256 Mb PCI 33. Samsung original
5 1 68 pin. 64 bit
LLJ
. 2.18.
(Field Link Editor)
jr
. 2.19. ,
.
TDBGrid
,
Available Indexes
. Detail Fields , . Category. Master Fields
. ,
Detail Fields Category, Master Fields CategoryNo,
Add.
Joined Fields (. . 2.18). -
2.
. MasterFields
CategoryNo.
, , . OnCreate :
BDE, , , ,
. (Cached Updates Mode)
, , ,
, .
,
, MB, ,
Dell.MB Del2.MB. ,
. .
BDE : (TDatabase), ( TQuery),
( TBDEClientDataSef).
.
,
TBDEClientDataSet. TDatabase (TQuery). TDatabase TBDEClientDataSet , .
,
CachedUpdates true.
( Post) ,
, ,
(, cache).
,
ApplyUpdates, CancelUpdates.
94
ApplyUpdates ]
, , TDatabase, !
, ApplyUpdates CommitUpdate
CancelUpdates , ,
ApplyUpdates CancelUpdati
( ).
( 6asi
) - TI
.
. , ApplyUpdates
.
, ,
.
ApplyUpdates CancelUpdates
. ,
CachedUpdates true.
,
CachedUpdates false
( ). ,
UpdatesPending.
true, . , ,
( ) <
UpdatesPending. , CachedUpdates
true. UpdatesPending false, <
ApplyUpdates, ,
CancelUpdates . ,
, .
TBDEDataSet , :
typedef void
fastcall ( closure *TUpdateRecordEvent)
(Db::TDataSet* DataSet, Db::TUpdateKind UpdateKind,
TUpdateAction &UpdateAction);
typedef void
fastcall ( closure *TUpdateErrorEvent)
(Db::TDataSet* DataSet, b::EDatabaseError * E,
Db::TUpdateKind UpdateKind, TUpdateAction &Upd'ateAction) ;
, .. ApplyUpdates . OnUpdateRecord
TUpdateRecordEvent ,
, .
, ,
.
DataSet, OnUpdateRecord .
UpdateKind TUpdateKind, ,
2.
95
, . : ukModify ( ), uklnsert
( ) ukDelete ( ). .
- UpdateAction OnUpdateRecord. ,
UpdateAction TUpdateAction. : uaAbort ( ), uaApplied ( , . . ),
uaFail ( , ),
uaSkip ( , ).
uaRetry ( ), OnUpdateRecord.
, UpdateAction uaFail.
, , , , .
,
OnUpdateRecord UpdateAction uaApplied.
- , OnUpdateError. ,
throw, . :
OnUpdateRecord,
(, ) EDatabaseError. . OnUpdateError
- .
, ,
, . , TDBGrid, TTable TDataSource, , , . Tablel Items MyData.
, CachedUpdates
true. .
Q (TCheckBox) (TLabef). CBUpdatesPending
Caption. :
. .
, , .
Q () .
ButtonApply ,
ButtonCancel . , .
Q (TLabel). , : LIns
: 0, LDel : 0, LMod : 0, LErr : 0.
,
, .
96
. 2.20.
,
;
CBUpdatesPending.
Post, AfterPost Table!
:
CBUpdatesPending->Checked=Tael->UpdatesPending;
Post CBUpdatesPending UpdatesPending.
* 1
r.t. . *
\
_
; :
jftem
1 Samsung 530
2 Samsung ML-1^10
3 Epson EPL-5900L
- "
4 Canon LBP-810
5 Brother HL-1 240 Mono Lase
6 Epson AcuLaser C1 OOOw
? EpsonAcul_oserC20GQ
8 HP LaserJet 1000
9 HP LaserJet ?200
iLd
|Cgp
'-.
1
; ni'! &:!}-"
""- - 1
-_ij
A4. GDI. 2 . 600 dpi, ppm, 1 50 -1
GDI. 8 . 600 dpi, ppm, 1 %'
4, GDI, 2(13) , 600 dpi, 12 ppm. -: :;:
4. GDL 600 dpi, 8 ppm, 1 00 . LF :.:.
4, 2&, 600x600 dpi, 1 2 ppm, 250 ;. - '..
4, , 1 6(256) . 600 dpi/2400 dpi RIT. \
4, , 84(512) , 600 dpi/2400 dpi RIT. , .
4. 1 , GDI. 600 dpi 1 D ppm, 2 |
4. 0(72) . 1?00 dpi, 1 4 ppm, 250
. 2.20.
, , ButtonApply ButtonCancel.
ApplyUpdates CommitUpdates.
, ,
- CancelUpdates.
CBUpdatesPending, CommitUpdates,
CancelUpdates . ,
, AfterPost.
ButtonApply ButtonCancel
, .
NDel, NIns, NMod NErr. Unitl.cpp,
:
TForml *Forml;
:
2. BDE
97
#ifndef UnitlH
define UnitlH
//-.
include <Classes.hpp>
include <Controls.hpp>
i nclude <5tdCtrls.hpp>
include <Forms .hpp>
include <DB.hpp>
include <DBGrids.hpp>
include <DBTables.hpp>
include <Grids . hpp>
i nclude <ExtCtrls.hpp>
include <DBClient.hpp>
include <DBLocal .hpp>
i nclude <DBLocalB.hpp>
include <Provider .hpp>
//..
class TForml : public TForm
published:
// IDE-managed Components
TDBGrid DBGridl;
TTable *Tablel;
TDataSource *Data5ourcel;
TButton *ButtonUpdate;
TButton *ButtonCancel;
TCheckBox *CBUpdatesPending;
TPanel *Panell;
TPanel *Panel2;
TLabel *LIns;
TLabel *Label2;
TLabel *LDel;
TLabel *LMod;
TLabel *LErr;
void
fastcall ButtonUpdateClick(TObject Sender)
void
fastcall ButtonCancelClick(TObject Sender)
void
fastcall TablelAfterPost(TDataSet *DataSet)
void fastcall TablelUpdateRecord(TDataSet DataSet,
TUpdateKind UpdateKind, TUpdateAction &UpdateAction);
void
fastcall TablelUpdateError(TDataSet *DataSet,
EDatabaseError *E, TUpdateKind UpdateKind,
4 . 319
98
TUpdateAction &UpdateAction) ;
void _ fastcall FormCloseQuery(TObject *Sender, bool &CanClose)
private: // User declarations
void _ fastcall UpdateLabel(void) ;
public:
// User declarations
_ fastcall TForml (TComponent* Owner);
extern PACKAGE TForml *Forml;
//--#endif
2.6. CachedUpdates
#include <vcl.h>
#pragma hdrstop
#include "Unitl.h"
#pragma package(smart_ini t)
#pragma resource "*.dfm"
TForml *Forml;
int NDel, NIns, NMod, N E r r ;
_fastcall TForml::TForml(TComponent* Owner)
: TForm(Owner)
NDel=0; NMod=0;
NIns=0; NErr=0;
void _ fastcall TForml: :ButtonUpdateClick(TObject Sender)
{
Tablel->ApplyUpdates() ;
Tablel->CommitUpdates() ;
CBUpdatesPending->Checked=Tablel->UpdatesPending;
UpdateLabeK) ;
void _ fastcall TForml : :ButtonCancelClick(TObject *5ender)
{
Tablel->CancelUpdates() ;
CBUpdatesPending->Checked=Tablel->UpdatesPending;
UpdateLabeK) ;
void _ fastcall TForml : :TablelAfterPost(TDataSet *DataSet)
{
CBUpda te s Pending->Checked=Tabl el ->Updates Pending;
void _ fastcall TForml : :TablelUpdateRecord(TDataSet *DataSet,
TUpdateKind UpdateKind, TUpdateAction &UpdateAction)
2. BDE
UpdateAction=uaApplied;
switch(UpdateKind)
case ukModify:
{ NMod++; break; }
case uklnsert:
{ NIns++; break;}
case ukDelete:
{ NDel++; break; }
void
void
void
99
100
. , RevertRecord
, !
UpdateObject - TUpdateSQL,
, . . !
, Using the BD
to cache updates C++ Builder.
(Database Desktop ), ,
.
, , SQL. BDI
.
,
, . AddAlia
TSession. Session TSession ,
, BDE. !
TSession . STANDARL
(Paradox, dBASE, ) AddStandardAlias
TSession, AddAHas. , MyDatal
Paradox :
if ( ! S e s s i o n - > I s A l i a s ( " M y D a t a l " ) ) S e s s i o n - > A d d S t a n d a r d A l i a s (
"MyDatal", " D : \ \ M y D a t a l " , "PARADOX");
AddStandardAlias ,
, .
AnsiString : "PARADOX"
"DBASE", "ASCUDRV" ( ).
, ,
IsAlias TSession.
, . !
, true.
new.
, delete:
* Tablel= new T T a b l e ( t h i s ) ;
delete(Tablel);
,
:
Tablel->DatabaseName="MyDatal";
Tablel->TableName="Itemsl.db";
Tablel->TableType=ttParadox;
. -
2.
101
NewFieldDef->Name="Item";
NewFieldDef->DataType=ftString;
NewFieldDef->Size=50;
NewFieldDef->Requi red=true;
.
MQToaAddlndexDef, TIndexDef.
. ,
ItemNo:
NewIndexDef->Name="<Primary>";
NewlndexDef->FieIds="ItemNo";
NewIndexDef->Options=TIndexOptions() ixPrimary i x U n i q u e
CreateTable. 2.7 Item, .
2.7. Item
102
NewFieldDef->DataType=ftString;
NewFieldDef->Size=100;
NewFieldDef=Tablel->FieldDefs->AddFieldDef();
NewFieldDef->Name="Index";
NewFieldDef->DataType=ftString;
NewFieldDef->Size=5;
NewFieldDef->Requi red=true;
NewFieldDef=Tablel->FieldDefs->AddFieldDef();
NewFieldDef->Name="Price";
NewFieldDef->DataType=ftCurency;
NewFi eldDef->Required=true;
TIndexDef* NewIndexDef=Tablel->IndexDefs->Add!ndexDef();
NewIndexDef->Name="<Primary>";
NewIndexDef->Fields="ItemNo";
NewIndexDef->Options=TIndexOptions() ixllnique;
NewIndexDef=Tablel->IndexDefs->AddIndexDef();
NewIndexDef->Name="ItemNDX";
NewIndexDef->Fields="Item";
NewIndexDef->Options=TIndexOptions() ixUnique;
Tablel->CreateTable();
delete(Tablel);
BDE
, TSession, TDatabase, TQuery,
(Data Controls),
.
BDE
.
, .
: / , , , , . ,
TDataSource TField.
, TDataSource !
, , ..
(Dynamic)
(Persistent) . , .
, . , (Calculated)
(Lookup Fields).
(Master/Detail), ,
, .. .
BDE
()
TDataba.se TSession
SQL
TQuery
TUpdateSQL TBatchMove
( TDataModule) ,
. ,
,
.
, (,
, ).
.
, TDataSource,
TQuery, TDatabase, TSession, TStoredProc
.. Data Access,
104
. 3.1.
Umtl cpp UniG.cpp j
lUnliltedl
3 J
Modified
ii
li J
:
'Insert
\Umt2 '- 1
h ADiagretri./
3. BDE ()
105
, ,
. Include Unit Hdr
File.
->__, ,
DModl->Tablel. . ,
,
,
Diagram .
. 3.2 , Master/Detail
Category Items.
, : OnCreate OnDestroy. TNotifyEvent.
. OnCreate , , .
OnDestroy : , ..
-
.
'
TDatabase
BDE
TDatabase. TDatabase
,
DatabaseName .
, TDatabase,
. TDatabase
- .
, MyData TDatabase, , BCDEMOS,
TDatabase. TDatabase
Database, TDBDataSet.
,
Edit]
TDatabase :
Editl->Text=Tablel->Database->DataSetCount;
, MyData Tablel
2, Editl 2.
106
, BI
TDatabase.
,
, ,
.
TDatabase
TDatabase >
(alias). !
( SQL Explorer BDE Administrator),
, AliasName.
DatabaseName
DatabaseName
.
. ^
, DriverName,
. , STANDARD ( Paradox dBASE), INTRBASE (:
InterBase) . . , , !
DatabaseName ,
( TQuery) . AliasName
- , , AliasName Driver
Name .
.
DriverName,
, TDatabase.
Params, ( TStrings).
Params
=. , >
(. . )
, Params , .
. STANDARD (Paradox dBASE)
INTRBASE MSACCESS :
PATH=d:\MyData
SERVER NAME=d:\IBase\MyIBase.gdb
DATABASE N A M E = d : \ D a t a \ N o r t h w i n d . m d b
//STANDARD
//INTRBASE
//MSACCESS
, .
, Params
, ,
, . .
ODBC
SQL Links, BDE. ,
SQL, , , .
3. ()
107
j-jMyOOB
Eammeler overrides
SERVER NAME'd\Temp\photodatabase gdb
USER NAME-SYSDBA
P*SSWORD=rrmsterkey
Login prampt
17 beep inactive connection
. .4. TDatabase
photodatabase.gdb INTRBASE
108
3. ()
109
Memol->Clear();
for (int i = 0; i < Databasel->DataSetCount; i++)
{
TTabTe* MyTable;
MyTable=dynamic_cast<TTable *>(Databasel->DataSets[i]);
if(MyTable) Memol->Lines->Add(MyTable->TableName);
}
,
(Memo!), TDatabase (Database!) . .
, Memol.
, Database!. * (. . ,
). , Memol
, .
Locale ,
TDatabase. .
IsSQLBased ,
TDatabase ODBC SQL Links. InTransaction
. true ,
. , .
,
TDatabase , TDatabase
. HandleShared.
TDatabase ,
true.
{Transaction)
( ). , ,
. , , , , , , , .
, , , . . , , ,
( ).
( ),
110
( ). ().
. />- ( ),
. .
Q (Atomicity). , , .
Q (Consistency). .
Q (Isolation). () .
LI (Durability). , , . .
BDE
. , , .
,
.
(,
, ), , TDatabase.
( )
TDatabase . ,
, StartTransaction. Commit , Rollback .
try...catch.
. StartTransaction TDatabase.
try
. Commit .
- , catch Rollback
. ,
(cached updates):
Databasel->StartTransaction() ;
try
{
Tablel->ApplyUpdates()
;
Databasel->Commit() ;
}
catch (...)
{
Databasel->Rollback() ;
throw;
}
Tablel->Commi tUpdatesQ ;
3. ()
, Rollback throw . ,
CommitUpdates, .
Tramlsolation TDatabase.
TTranslsolation.
:
tiDirtyRead .
, .
Q tiReadCommitted SQL.
(committed) .
Q tiRepeatableRead' .
, .
STANDARD (Paradox, dBASE), tiDirtyRead.
(ASCIIDRV) .
GetTableNames GetFieldNames TDatabase.
:
void
112
Database! Forml, ]
. Include Unit Hdr MI
File. ,
(Unit2) . (Unitl) erpi
^include "Uni2.h". , .
ListViewl, ,
. ,
OnCreate:
void
{
}
GetTableNames,
Items ListBoxl ,
Database!'. ( 0)
GetFieldNames, Items ListView2
, (. . ,
). , Database!
-> DModl.
Category
EmployeeNo
LNome
FName
Suppliers
MNome
HireDtfe
FireDeta
Description
Photo
Birthday
. .5.
GetTableNames GetFieldNames
ListView.
ListViewl.
OnClick TListView. 1
, ;
. OnClick
ListViewl :
void
{
3. BDE ()
113
, ,
(. . 3.5).
, :
Access violation at address 00407C59 in module 'PROJECT! F.XE'. ,
OnCreate
DModl.
. , . Options Project.
Project Options Forms.
(Auto-create forms). Form? - , FormJ. ,
DModl .
.
Project View Source. ^
Project).. CreateForm Application.
, :
TDatabase
TDatabase ,
. TDatabase OnLogin. BeforeConnect, AfterConnect,
BeforeDisconnect AfterDisconnect TCustomConnection, TDatabase.
TNotifyEvent, OnLogin :
typedef void
fastcall ( closure *TDatabaseLoginEvent)
(TDatabase* Database, Classes::TStrings* LoginParams);
OnLogin ,
, LoginPrompt true
( ). ,
, , , Params TDatabase.
LoginParams, TStrings. ,
OnLogin INTRBASE:
void
114
OnLogin ,
Params ,
.
BeforeConnect AfterConnect
. - , . ,
,
BeforeConnect Params
TDatabase.
, .
, .
void
{
}
BeforeDisconnect After Disconnect,
,
, , .
TSession
, TDatabase
, TSession , ( TDatabase), .
TSession, , (TDatabase).
:
Q , (, , , . .);
Q
;
G OnPassword OnStartUp TSession;
Q Paradox (NetFileDir) (PrivateDir) ;
Q Paradox, .
TSession. , ( TDatabase ).
, , ,
TDatabase. Object TreeView Default,
3. BDE ()
115
TSession. ,
(, ),
Session TDatabase.
TSession Session.
TSession , , BDE ,
. TSession, . , , ,
. ,
(Threads),
TSession.
,
TSession.
TSession
TSession,
( Name) ( SessionName).
,
. SessionName.
,
(Default).
. , ,
Session, Default.
, TSession. , .
, , .
Object TreeView.
,
SessionName .
TSession , . T:vm& AutoSessionName.
true, BDE
( SessionName).
, _ . , Session! Session!_1. ,
, TSession .
AutoSessionName true, SessionName ( TDataSet)
(TDatabase) . , ,
AutoSessionName true.
. -
116
,
TSession ( Default
). , TSession
AutoSessionName
true. ,
SessionName,
.
KeepConnections ;
KeepConnection
. KeepConnection TDatabase ]
, . SQLHourGlass (
, :
. , , .
true, SQL, BDE
SQL- .
.
NetFileDir Paradox
PDOXUSRS.NET, BDE Paradox. ,
Paradox. PrivatDir , BDE .
BIN , C++ Builder.
, , Active true. , Open.
PrivateDir, NetFileDir,
ConfigMode. Active,
false, Close. , ,
.
. , .
, , .
TSession
Databases DatabaseCount. ,
, . ,
, Sessionl :
Sessionl->Active=true;
for (int i = 0; i < Sessionl->DatabaseCount; i++)
Sessionl->Databases[i]->Active = true;
, , (, , ) .
TSession . OnStartup
Active false true.
3. ()
117
, , , . OnPassword
Paradox, . ,
BDE Paradox,
.
OnPassword (,
AddPaSsword TSessiori). Sender
TObject, OnPassword
Continue. true, BDE, .
OnPassword , BDE
. Paradox dBASE, , .
OnPassword Sender,
TObject. , TSess/on,
,
.
Paradox dBASE
Paradox dBASE . SQL Explorer Database Desktop. , Paradox Database Desktop,
( Restructure Table)
Password Security Table properties. , Define, Modify.
Master pass word Verify master password.
Delete , Change . Auxiliary Passwords
, ,
, , ..
. 3.6.
,
, .
TSession ,
Paradox dBASE.
118
, TSession
, , BDE
. '
, ,
. TSession ,
(. . 4.6).
( Add), ( Remove)
, TSession (Remove all). BDE
OnPassword, .
- -
AddPassword. AnsiString,
. AddPassword ,
. , Session! . ( ) ,
Passl, Pass2, Pass3 Pass4 . , , , OnPassword
:
void
{
}
, true Continue, ,
.
A ddPassword OnPassword.
, , , ,
AddPassword ,
.
TSession, .
RemovePassword RemoveAllPasswords. Remove? assword
AnsiString, TSession.
AddPassword.
RemoveAllPasswords ,
TSession. .
, , ,
,
.
3. BDE ()
119
, . GetPassword,
. OnPassword .
, ,
. GetPassword true, ,
false, Cancel. GetPassword
, TSession
, .
TSession , . , .
AddAlias viAddStandardAlias , (, BDE Administrator)
BDE, , .
AddA lias :
void
Name Driver , ,
. AddAlias TStrings. TStrings
, TStringList. List , , ,
..
,
employee.gdb INTRBASE. ParList
TStringList. try . SER VER NAME,
, USER NAME PASSWORD. .
DBGridl DataSourcel, Tablel. Tablel MySession
( SessionName), ( DatabaseName)
Sales ( TableName). Open
DBGridl .
void
{
120
fj n a 11
delete(ParList);
DBGridl->DataSource=DataSourcel;
DataSourcel->DataSet=Tablel;
Tablel->SessionName="MySession";
Tablel->DatabaseName="MyIntrbase";
Tablel->TableName="Sales";
Tablel->0pen();
, . ,
.
, , , .
IsAlias TSess/on. ,
, true.
ConfigMode TSess/on.
: cfmVirtual ( ,
, , ); cfmPersistent (
); cfmSession ( , ). .
AddAHas
SQL. STANDARD (Paradox, dBASE ) AddStandardAlias. ,
AnsiString. , .
: Paradox, DBASE ASCIIDRV.
DeleteAlias .
. ModifyAlias , . AnsiString . TStringList*
. ,
TStringList.
, BDE
. BDE, SaveConfigFile. ,
BDE ,
, BDE, -
3. BDE ()
121
TSession , Get. , , , , , . TStringList*, .
' , TStringList ,
, .
, TStringList* (TString*).
122
void
void
void
, . , ,
:
try
{
Sessionl->GetAliasNames(MyLi st);
Li stBoxl->Items=MyList;
Li stBoxl->ItemIndex=0;
fi n a 11
delete MyLfst;
}
, , TStringList,
,
Session 1. ,
Items ListBoxl, . ListBoxl.
TStringList , .
Get ,
TStringList* (TString*), :
void
3. ()
123
//
#ifndef UnitlH
#defme UnitlH
//
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DBTables.hpp>
//
class TForml : public TForm
{
published:
// IDE-managed Components
TListBox *ListBoxl;
TSession *Sessionl;
TComboBox *ComboBoxl;
TLabel *Labell;
TListBox *ListBox2;
TLabel *Label2;
TListBox *ListBox3;
TLabel *Label3;
124
#include <vcl.h>
#pragma hdrstop
#include "Unitl.h
#pragma package(smart_ini^t)
#pragma resource "*.dfm"
TForml *Forml;
_fastcall TForml : :TForml (TComponent* Owner)
: TForm(Owner)
3. ()
125
case 1: //
{
Sessionl->GetDri ve r Names (My Li st) ;
Width=330;
ListBox3->Visible=false;
Label 3->Visible=false;
break;
}
case 2: //
{
Sessionl->GetDatabaseNames(MyList) ;
Width=495;
ListBox3->Visible=true ;
Label3->Visible=true;
break;
Li stBoxl->Items=MyLi st ;
ListBoxl->ItemIndex=0;
Label!- >Caption=ComboBoxl->I terns- >St rings
[ComboBoxl->ItemIndex]+" : " ;
}
_ finally
{
delete MyList;
}
ListBoxlClick(NULL) ;
>
//
-----------------------------------------------------------------void _ fastcall TForml : : ListBoxlClick(TObject *Sender)
I
TStringList *MyList=new TStringListO ;
try
{
swi tch(ComboBoxl->ItemIndex)
{
case 0: //
{
Sessionl->GetAliasParams (Li stBoxl->I terns- >
5trings[ListBoxl->ItemIndex] , MyList) ;
Label2->Caption="napaMeTpbi: " ;
break;
}
case 1: //
{
Sessionl->GetDriverParams(Li s tBoxl->I terns- >
Strings[ListBoxl->ItemIndex] .MyList) ;
Label2->Caption = "riapaMeTpbi: " ;
break ;
126
case 2: //
{
Sessionl->GetTableNames(Li stBoxl->I terns ->
Strings[ListBoxl->ItemIndex] ,
"" , false, false, MyList) ;
Label2- >11=": " ;
break;
ListBox2->Items=MyList ;
ListBox2->ItemIndex=0;
}
_ fl n a 1 1
{
delete MyList;
}
if (ComboBoxl->ItemIndex == 2) ListBox2Click(NULL) ;
}
// ----------- .
void __ fastcall TForml: :ListBox2Click(TObject *Sender)
{
i f (ComboBoxl->ItemIndex != 2) return;
TStringList *MyList=new TStringLi st () ;
try
{
}
_ fi n a 1 1
{
delete MyList;
GetSessionlnfo
OnCreate Forml.
ComboBoxl. ,
, . :
ListBoxl , ListBox2
. , ListBoxS, Labels , .
Width 330.
, OnChange ComboBoxl OnClick ListBoxl.
ListBoxl , ListBox2.
3. ()
127
DefauUDO
IBLocel
MyOata
MvOotol
MS Access
:unl FoxPro
& Visual FoxPro
dSASE
. .7. GetSessionlnfo
GetSessionlnfo, , . ,
, .
, . . - ,
TSession, .
GetAliasDriVerName
GetConf/'gParams.
.
.
C++ Builder .
128
, ,
, . , -
, -
Data-Aware Controls ( Data Controls).
Data Controls . , ;
,
. , .
Data Controls , Standard. ,
TEdit TDBEdit, TLabel TDBText, ..
, Data Controls
DataSource. ,
, .
, .
Data Controls
. , TDBGrid TDBCtrlGrid,
. ( TDBGrid). , , ,
. , . ,
, (, , . .), (TDBGrid). , . ,
, .
, . ,
(TDBCheckBox), TDBImage,
Memo TDBMemo . .
.
, , ( TDBGrid).
,
()
. Data Controls :
TDBText, TDBEdit, TDBMemo, TDBImage, TDBCheckBox TDBRichEdit.
3. ()
129
, .
DataSource ( TDataSource),
, .
DataField, .
, , ,
.
, . (Field Editor),
, .
-
. TDBNavigator,
Data Controls, - (First, Last, Next . .).
,
, . .
, , TDBEdit , ; TDBText ; TDBRichEdit
, . .
Data Controls
TDBNavigator ( ).
, .
, , ,
.
TDataSource. VisibleButtons. (Set)
,
(, nbFirst, nbPrior . .). , false. ,
.
. 3.8. .
TDBNavigator Employee
5 .319
130
. 3.8
. ( TDBNavigator).
, TDBGrid. ,
, .
Data Controls ,
,
. (TDBListBo)
TDBLookupListBox), (TDBComboBox TDBLookupComboBox
(TDBRadioGroup).
TDBListBox, , ,
Items. DataSource DataField TDBListBo)
().
, !
.
.
TDBLookupListBox. 5
TDBLookupListBox , TDBListBox.
, TDBLoohipListBox Items.
ListSource ListField. ListSource TDataSource,
,
. (Lookup Table)
ListField.
, ,
.
TDBLookupListBox, ?
, KeyField.
, .
KeyField (
). , ;
TDBLookupListBox Category,
. ListField (
Category, KeyField CategoryNo, \
. , ,
.
,
TDBLookupListBox DataSource DataField.
, TDBLookupListBox
. , DataField, ,
KeyField, )
. KeyField
, DataField
.
3. ()
131
(
Category), TDBLookupListBox
Items. DataField Category,
Category. ,
TDBLookupListBox ,
Category Items Category. Items,
- .
TDBLookupListBox ,
: ListSource, ListField, KeyField, DataSource
DataField. ,
,
TListBox, , TDBListBox.
TDBComboBox
TDBLookupComboBox. TDBComboBox , Items,
TDBLookupComboBox ( ListSource, ListField KeyField).
.
,
-
TDBRadioGroup.
DataSource DataField,
Items. , Columns. 1, . .
. Values TString
, Items.
Values , DataField.
( TDBChart)
TDBChart , . TDBChart , Data Controls.
, (. .
3.9),
.
, .
:
(, , ..).
, , .
132
. ,
TDBChart.
,
MyData . Storage,
. Storage !
3.1.
3.1. Storage
Tun
(Type)
(Size)
StoreltemNo
Autoincrement (+)
Item
Yes
No
No
(Field Name)
Qty
Short (S)
Description
Memo (M)
240
(Key)
*
(Required)
Yes
, Storage . StoreltemNo
, Item , <
Items. Qty
. , *
(. .
). Description
, , .. )
Storage Items Item ItemNo.
Database Desktop,
. Storage ,
() MyData.
labels: (C
. .9. ( TDBChart)
3. ()
133
.
TBatchMove. Tablel Storage
MyData, 2 Items . Active true.
, Source BatchMovel 2,
Destination Tablel. ,
Items Storage.
Mappings :
Item=IternNo
Mappings -,
. -
, -
.
(TButton), OnClick
:
BatchMovel->Execute();
,
BatchMovel, Item Storage.
Qty , , , .
.
OnClick :
randomizeO ;
Tablel->First() ;
while (!Tablel->Eof)
{
Tablel->Edit() ;
Tablel->FieldByName("Qty")->Value=random(100);
Tablel->Post();
Tablel->Next();
}
134
, SQL.
(Category, Items Storage),
(.. , ).
Category , Storage
, . Items ,
Category Storage. SQL , TQnery. Active Query! true.
DBChartl. .
Chart ( ) ,
Series. ,
. . Add,
TeeChart Gallery Pie
. Seriesl.
. 3.10. ,
, Series.
Data Source Dataset. Data Source
(. . 3.9). Dataset
Query 1. Labels Category, Pie Cost. ,
Cost ( ),
Category.
, , .
Marks Style Label and Percent.
Chart Titles.
TDBChart - . , .
, .
Legend Visible. Etce, (. . 3.10).
3. BDE ()
135
TDBCtrlGrid
TDBCtrlGrid, TDBGrid,
. -. TDBGrid
, TDBCtrlGrid
. (TDBEdit, TDBImage ).
. 3.11. TDBCtrlGrid
TDBCtrlGrid , (. . 3.11).
,
. TDBCtrlGrid
DataSource.
, .
.
(. . 3.12).
. TDBNavigator, .
TDBCtrlGrid
. ,
.
,
( , ).
. 3.12. TDBCtrlGrid
136
TDBCtrlGrid
.
G ColCount RowCoimt.
ColCount 1, RowCount 3. '
, 3 .
.
Q Orientation. ( ).
Q AllowDelete Allowlnsert. !
.
( TDBGrid)
Data Controls,
, TDBGrid. ,
. TDBGrid ( )
, . . .
, ( )
, ,
.
, .
- Columns,
.
Columns. TColumn
Columns TDBGridColumns
TColumn. TColumn
. Columns TColumn,
.
( TColumn) (Column Editor).
, Columns (. .
3.13).
TColumn, . ,
.
, TColumn , BDE - ,
.
TColumn,
. TColumn, Ins ,
Add New ( ),
Add .
: 0 TColumn. 0 ( 1, 2,
3. ()
137
0 - Cetegoiy
1 -Item
"
. 3.13. TColumn
, -. , , FieldName.
TColumn .
. ,
-.
TColumn
, ,
.
.
Color, Font.
Alignment (,
).
Title TColumn.
- Title TColumnTitle. ,
.
, .
Caption. Title
, . . 3.13 , TColumn. , .
, . 3.14.
|
Samsung ML-
j *j
18900 ^
Samsung ML-121Q
20300 .
Epson EPL-5900L
239 00
^ MH | LBP-81 0
Brother HL-1240 Mono Loser
l.[nn
215QO
26
1.34900
2,15500
HP LaserJet 100Qw
22-1 OOt =
HP LaserJet! 200
332.00*
44000*
= HP LaserJet 3200
637 00|
. 3.14.
TDBGrid, ,
; ,
138
> 1
V Samsung ML-450G
1 *
ft
*.,
10900$ 'I
Samsung ML-1 21 0
203.001
Epson EPL-590QL
239.001
Canon LBM10
215001
,1
1 tump
Samsung ML-450Q
[(
Samsung ML,-1210
I ..
Epson EPL-5900L
239 JO
|_8-10
215.00
-
^_
\ [ '' * HP LaserJet 1200
||
-
203 DOt
266 00
1.3-19 00
2.156.00
I-
221 00
332.00
;.
. 3.16.
(lookup field),
(lookup field), ( ),
, PickList .
, . 3.14,
Category, (long integer).
Category CategoryName.
Category FieldName
CategoryName PickList, ,
(. . 3.16).
3. ()
139
cbsNone ButtonStyle ,
.
ButtonStyle cbsEllipsis, ,
( Ellipsis). (. . 3.17) OnEditButtonClick TDBGrid. OnEditButtonClick , ,
, , ,
( ).
>1
Samsung ML-45M
1 Samsung Mi_-1 21 0
1 Epson EPL-59GQL
1 Canon LBP-810
----- --
|*j
las.ous1^
"03.00$
239 00*
21500$
:.. -^
Type String.
Q Size 25.
Q Field Type Lookup.
Q Key Fields Category.
140
Q DatasetTable2.
G Lookup Keys CategoiyNo.
G Result FieldCategory.
Tablel
CategoryName.
Forml. ,
( Caption) - , Items.
TDBGrid, (DBGridl)
DataSource : DMod l-> DataSource 1.
Columns DBGridl,
FieldName CategoryName, Item Price.
(CategoryName) ButtonStyle
cbsEllipsis. .
. Title TColwnn. ,
. 3.16, (- Title):
Q Caption , ;
G
Alignment taCenter;
3. ()
141
TField* SelF;
SelF=DBGridl->SelectedField;
if (SelF)
if (SelF->FieldName=="CategoryName")
{
SelF *, SelectedField. ,
- ( SelF
NULL). SelF , . CategoryName, Form2,
. , .
OnEditButtonClick , Form!.
( Project \ Options) Forms. (Auto-create forms)
Form2 (>). Form2
(Available forms).
Form2. , ,
, . , , Form2
.
OnCreate Form2. :
void _ fastcall TForm2 : : FormCreate(TObject *Sender)
{
AnsiString ValString;
ValString=Forml->DBGridl->SelectedFi eld- >AsSt ring;
if (! (ValString.IsEmptyO))
{
TLocateOptions SearchOptions ;
DModl->Table2->Locate("Category", ValString, SearchOptions);
OnCreate SelectedField.
ValString DBGridl,
142
Forml. , /
Locate Table! ( Category) nepi
, Category <
ValString.
Form2 ( TButtori). <
( )
Category Items, Form
. Form2
. , Cancel.
OnClick :
void
GridDataSetl->Edit();
GridDataSetl->FieldByName("Category")->Value=
GridDataSet2->FieldByName("CategoryNo")->Value;
GridDataSetl->Post() ;
Close 0;
3. ()
. ..)
St.
- * -I-! I I ?
.1(-(1|1
-lEi
>
. ,
,
'(
Efu;
Ef;-;
/
,;:.
^
HI :HI
143
>;:fMlMf! '
_*]
, . 1
Intel, Aind VIA
DIMM. DIMM DDR RlMM ' .
- -
i
iLJ
OK " """|
Cancel
. 3.18. ,
( TDBGrid)
, TColumn,
, .
- Columns TDBGridColumns. ,
TDBGridColumns , : Items ( ) Count
( ). ,
.
DBGridl ListBoxl , .
for(int i=8; i <DBGridl->Columns->Count ;
144
. RebuildColumns
TColumn,
.
TDBGrid,
, Options (]. - (Set)', 13 TDBGridOption. ,
,
true. .
Q dgEditing . ,
dgRowSelect.
LJ dgAlwaysShowEditor ,
Enter F2, . dgAlwaysShowEditor , dgEditing dgRowSelect.
G dgTitles ,
.
Q dglndicator
, .
Q dgColumnResize ( ).
dgColLines .
dgRowLines .
dgTabs Tab ShiftTab. dgTabs , Tab
(Shift-Tab) , (
Shift-Tab ).
Q dgRowSelect ,
. ,
. dgEditing dgAlwaysShowEditor .
dgAlwaysShowSelection
, .
dgConfirmDelete , Ctrl + Delete, .
Q dgCancelOnExit
,
.
.
Q dgMultiSelect (
). , Ctrl.
3. ()
145
.
( ), (TCheckBox) .
, ,
dg ( Options).
Tag 1 13.
Caption TPanel. Bevellnner BevelOuter
bvLowered bvRaised .
TDBGrid, TTable TDataSource. DBGridl
DataSourcel, DataSourcel Table 1. Table!
Items MyData .
, - .
,
TCheckBox*. ,
IsFormCreate , true ,
. (Unit.h)
private TForml:
bool IsFormCreate;
TCheckBox* CBOpt[13] ;
. OnCreate Checked
true, ,
false .
CBOpt, TForml.
. TCheckBox*, CBOpt. ,
:
i n t j=0;
for(int i=Q; IComponentCount ; i++)
{
,
. :
for(int i=8; i<13; -i++) CBOpt [i] ->Checked=
DBGridl->Options.Contains((TDBGridOption) (CBOpt [i] -
146
Tag
( 0),
TDBGridOption. , ]
TDBGridOption.
, Checked
( Contains Set true,
).
,
OnClick.
Tag, . OnClici
(, ) OnClick ?
.
Sender TCheckBox*, , ?
. , Checked . , ( TDBGridOption)
, . ,
Tag ( ),
TDBGridOption. , :
TCheckBox* TCB;
TDBGridOptions Opt=DBGridl->Options;
TCB=dynamic_cast<TCheckBox*>(Sender);
if(TCB)
{
if(TCB->Checked)
DBGridl->Options = Opt
((TDBGridOption)(TCB->Tag-l));
else
DBGridl->Options = Opt
((TDBGridOption)(TCB->Tag-l));
-}
, OnClick ,
,
Checked. ,
OnClick OnCreate .
, IsFormCreate,
private TForml. OnCreate
false, - true.
, Checked IsFormCreate
false. , OnClick:
if (! IsFormCreate) return;
.
3.3 3.4.
. 3.19.
3.3. GridOptionsDemo
//
#ifndef UnitlH
#defme UnitlH
3. ()
#endif
.4. GridOptionsDemo
147
148
#pragma package(smart_ini t)
#pragma resource "*.dfm"
TForml *Forml;
//
__________________
_
_ fastcall TForml : :TForml (TComponent* Owner)
: TForm(Owner)
II
___________________________________
void _ fastcall TForml: : FormCreate(TObject *Sender)
{
int j=0;
IsFormCreate=false;
for(int i=0; iComponentCount ; i
TCheckBox* CBox=dynamic_cast<TCheckBox*> (Components [i] ) ;
if (CBox)
{
CBOpt[j]=CBox;
3. ()
149
lulsi*
p Column Resize & Tabs
t^limin liriss
. Titles
P indicator
F RowLmee
IternNo
>
iU
tern.
Confirm Delete
Row Select
K? Cancel On b'xii
'
-*)
1 Samsung ML-45GO
A Canon LBP-81 0
A .03Y2M6,6QQ*6DOapi.ao12pF>r
TDBGrid , . OnEditButtonClick,
, , Columns . OnTitleClick.
OnTitleClick
, .
:
typedef void
fastcall
OnTitleClick TColumn,
, . , Column
, .
OnTitleClick .
, ( , Windows
Commander -). ,
. .
OnTitleClick
OnTitleClick ,
. , ;
(TDBGridl), TDataSource TQuery.
, .
DataSourcel, , , Query].
DatabaseName Query 1 MyData.
, TQuery, TTable,
.
. , IndexName IndexFieldNames.
150
, Addlndex. ,
. , Items
.
, 9 ( !
: , ;
). ,
( Exclusive true). , -
. , TQuery
.
.
( Items) ( ItemNc
. }
SQL SQL Query 1
( ). ,
,
> ( ), < ( ).
,
, . (
^
.
(> < ]
(..
), , .. , ,
. . !
>.
. ;
TForml ( Unitl.h), private,
private:
AnsiString SQLString;
int Curlndex;
SQLString SQL,
Query 1. ?
Curlndex Columns.
:
OnCreate OnTitleClick DBGridl. Query!
. OnCreate Forml, .
void
{
3. ()
151
}
SQLString Curlndex.
SQLString ,
Items. ,
( ItemNo) .
( SQL .)
Curlndex 0. ,
, .. ItemNo.
SQL Query 1.
TString, .
Clear SQL, Add SQL ;.
SQL. Query 1 .
OnCreate
(, ). ItemNo, > ( ),
Caption . , >,
.
, , . OnTitleClick.
.
}
Query l->Active=f alse;
Queryl->SQL->Clear() ;
Queryl->SQL->Add(SQLString + OrderByString);
152
Queryl->Active=true;
DBGridl->Columns->Items[ind]->Title->Caption = CString;
if(Cur!ndex != ind)
{
TColumn* Col=DBGridl->Columns->Items[Curlndex];
Col->Ti tle->Caption=Col->DisplayName;
Curlndex=ind;
}
Queryl->First() ;
DBGridl->SelectedIndex=ind;
}
. fc char
Column, OnTitleClick. )
ColField AnsiString , !^
Column, ind Column Columns. , , ,
QueryI .
Column .
Column ,
(access violation).
AnsiString.
OrderByString SQL, .
CString ,
( > < ).
^/2; ( ).
fc >,
.
< ( < ).
, . , OnTitleClick,
.
, fc OrderByString CString. OrderByString
SQL, .
ORDER BY ( SQL ). ORDER BY ,
ColField, .
DESC, ,
. ColField
CString, , .
SQL Query]. ,
.
SQL, Query! . Column -
3. ()
153
JGa;sgorvJDescnpnon
5"Samsungl51BM
6" Sarntton 6
-',
-!
'
^^1|||||~
iU
Jj
. 3.20. Item
. ,
. ind Curlndex.
,
.
. . 3.20 ,
Item .
OnDrawColumnCell
TDBGrid OnDrawColumnCell,
( )
. OnDrawColumnCell , . ,
, , . ,
,
, .
:
typedef void
fastcall ( closure *TDrawColumnCellEvent)
(System::TObject* Sender, const Types::TRect &Rect, int DataCol,
TColumn* Column, Grids::TGridDraw5tate State);
Sender, ,
TDBGrid, . Sender ,
TDBGrid:
TDBGrid* grid=dynamic_cast<TDBGrid*>(Sender);
Rect TRect - , , . , ,
.
154
DataCol ,
, Columns. ,
Index
Column TColumn*. Column o6i
-, .
OnDrawCoIumnCell, State -
TGridDrawState
. !
Q gdSelected . ,
-.
G gdFocused . <
- .
U gdFixed .
}
DBGridl->Canvas->Brush->Color=ColCol;
DBGridl->Canvas->FillRect(Rect);
DBGridl->DefaultDrawColumnCell(Rect,DataCol,Column,State);
}
//, TColor. ColCol ,
3. ()
155
.
clSkyBlue.
,
. DataCol: 0, ,
.
clSkyBlue clMoneyGreen ( ). (
, .)
, .
Rect (
, ). FillRect
. OnDrawColumnCell
DefaultDrawColumnCell, . , OnDrawColumnCell,
.
DefaultDrawing. true ( ),
OnDrawColumnCell. ,
. OnDrawColumnCell DefaultDrawColumnCell. DefaultDrawing
false,
OnDrawColumnCell (, DefaultDrawColumnCell).
.
. 3.21.
Vw^nivjIJ^t'ipUii,-
MGBI.U <'?s,ir, n
2 Samsung MH21Q
. 3.21. TDBGrid ()
|l
ri
1 . GDI , dpi, s p
1 4, GQI,' SM&, 650 dpi, !
1 4. GDI. 2(13) . dpi,
1 -1. GUI. 1 dpi. '", nini..
< .
. 3.22. ,
,
, , ,
156
(. . 3.22). , !
, .
. ,
, ,
.
, ,
. RecNo . (
.
OnDrawColumnCell.
void
ColCol TColor;
:
TColor ColCol []={ clSkyBlue, clMoneyGreen };
(&) () .
ind 0, 1. ColCol. , .
. , (. . 3.23).
,,-.
.,
. 3.23.
, RecNo .
SQL RecNo -1,
. , GetRecNo SetRecNo,
RecNo /.
OnDrawColumnCell . , (
3. ()
157
TDBGrid) ( Storage). ,
(, 5), Qty
,
(, 10), Lime (-). .
,
TDataSource, , .
2 Items MaData, a Tablel
Storage . DBGridl DataSourcel, &DataSoureel Tablel. (Fields Editor),
Tablel .
StoreltemNo, Qty Item Storage. Visible Item
/se, . Storage Items (
New field). ItemName, String 50. Lookup
definition : Item (Key Fields), Table2 (Dataset), ItemNo (Lookup
Fields) Item (Result Field). OK Tablel.
OnDrawColumnCell DBGridl :
void
{
if(Qty 5) Color=clRed;
if((Qty >= 5) && (Qty = 10))
Color=clLime;
if(Qty fsBold;
}
if(State.Contains(gdSelected)) Color=clWhite;
DBGridl->Canvas->Font->Color=Color;
DBGridl->Canvas->Font->5tyle=5tyle;
DBGridl->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
FDefaultColor,
private TForml :
.
private:
TColor FDefaultColor;
FDefaultColor Form! , :
FDefaultColor=DBGridl->Canvas->Font->Color;
158
Color Style
DefaultDrawColumnCell, ;
,
if(State.Contains(gdSelected)) Color=clWhite;
, .
, ,
. , . . -
State gdSelected, .
. 3.24. , !
, , .
SlofetenijgemName
22 HPDeskJel656C
23 HP DeskJet 845C
HP DeskJet 920C
25 HP DeskJet 940C
26 HP DeskJet 960C
27 HPDeskJetSSOC
26 HPDeskJet990C "
29 HPPhotoSmartlllB
30 HP DeskJet 1220C
31 HPPSC500
32 HP Office Jet G55
|OV
[*]
12 .
<*
33
3
1 ijjji
54
; '
61
41
. 3.24. Qty ,
Qty
TDBGrid
. OnColumnMoved , ,
dgColumnResize. Sender . Fromlndex
Columns, Tolndex ,
.
OnColEnter OnColExit
. OnColExit,
OnColEnter. TNotijyEvent. , , ( /
) .
() .
TDBGrid, ,
OnCellClick ,
. , ,
. , . , () (
). OnCellClick
3. ()
159
TQuery
TQuery , TDataSet. TQuery
.
SQL . , , , .
TQuery
, SQL (
InterBase, DB2, Oracle, Informix, MS SQL Server, Sybase), (MS
Access, Paradox, dBASE, FoxPro) ODBC.
TQuery , . SQL, TQuery.
TQuery , :
Q , ;
Q , ,
;
, , , , ..;
Q ;
[ , ;
Q SQL, ;
G .
TQuery SQL,
SQL.
SQL
ANSI SQL92, ,
, SQL , .
, ,
. SQL
160
(Local SQL). , ,
.
SQL SQL-92;
(Paradox, dBASE, FoxPro). ]
ANSI SQL-92, SQL ,
. ,
SQL-92, SQL, . ;
, SQL
, BDE. BDE <
SQL- API BDE. , , ,
SQL .
SQL . , ;
, .
SQL () (DML Dai
Manipulation Language), (
(DDL Data Definition Language).
SQL ,
. BDE
, , , .
SQL
/* */
SQL .
(Date), ,
. :
(/
( ), ( )
( ):
"mm/dd/yy"
"mm/dd/yyyy"
(.). ( ), (
) ( ):
"dd.mm.yy"
"dd.mm.yyyy"
. SQL
hh:mm:ss AM/PM, hh , mm , a ss . AM , -
3. ()
161
( , AM ). AM
. ,
. : 12:24:00.
TRUE FALSE SQL .
. . :
Where (Actual=FALSE) And (Reserved="True")
, :
F.
(DML)
SQL DML
(Select), (Delete), (Insert) (Update).
(Select)
.
.
Select [Distinct] _
From _
[Where _]
[Group By __]
[Having _]
[Order By __]
SQL, SQL , (Clauses).
, .
; , ' . ( SQL .)
Select
Select , . _ ,
. . , From, .
(*).
, From.
, ,
(, ), :
Items.Index. , ,
. AS: ItemNo^S Number.
, ,
Select Distinct.
6 . 319
162
From
From .
From , . , !
Select, ,
From, .
. :
SQL
.
TQuery ,
, SQL .
, From,
. ANSI
, ("_"). SQL
ANSI,
>
: "Items, db". -
(, , ),
"Item Parts.db".
: "d:\Temp\Items.db". . : ":MyData:
Items, db". , SQL, : "Select".
SQL 3.2.
3.2. SQL
Active
And
At
Before
Both
Add
Any
Auto
Begin
By
All
As
Autoinc
Between
Bj^tes
Char
Character
Check
Column
Constraint
Current
Debug
Delete
Domain
Entry Point
Exit
Float
Function
Commit
Containing
Cursor
Dec
Desc
Double
Escape
External
For
Gdscode
Committed
Count
Database
Decimal
Descending
Drop
Exception
Extract
Foreign
Generator
After
Asc
Avg
Blob
Cache
Check_Point_
Length
Computed
Create
Date
Declare
Distinct
Else
Execute
File
From
Gen Id
Alter
Ascending
Base Name
Boolean
Cast
Collate
Conditional
Cstring
Day
Default
Do
End
Exists
Filter
Full
Grant
3. ()
163
Having
Hour
If
In
Input_Type
Isolation
Logfile
Group Commit
Wait Time
Int
Insert
Join
Lower
Inactive
Integer
Key
Leading
Index
Into
Long
Left
Like
Log_Buffer_Size
Manual
Max
Merge
Money
Nchar
Numeric
Or
Page Size
Plan
Protected
Read
Reserving
Right
Set
Size
Sqlcode
Sub Type
Then
To
Uncommitted
User
Varying
While
Message
Month
No
Of
Order
Page
Position
Primary
Real
Retain
Rollback
Shared
Smallint
Stability
Substring
Time
Trailing
Union
Value
View
With
Min
Names
Not
On
Outer
Pages
Post Event
Privileges
Record Version
Returning Values
Second
Shadow
Snapshot
Starting
Sum
Timestamp
Transaction
Unique
Values
Wait
Work
Minute
National
Null
Only
Output Type
Parameter
Precision
Raw Partitions
References
Returns
Segment
Schema
Some
Starts
Suspend
Timezone Hour
Trigger
Update
Varchar
When
Write
Inner
Is
Length
Level
Maximum
Segment
Module Name
Natural
Num LogJBuffers
Option
Overflow
Password
Procedure
RdbSDb Key
Reserv
Revoke
Select
Singular
Sort
Statistics
Table
Timezone Minute
Trim
Upper
Variable
Where
Year
Group
, From, (
). , : "Items.db" It. SQL
(). , ,
. ("Items.db"),
. , ,
(, ,
) .
From , (.. ) .
, From, -
. (Cartesian).
:
164
SQL- BDE (, ,
) , , !
From. , *
Items
Storage. , Items 10 , ;
Storage 5, ,
10 5 = 50 .
From
. , ;
(
SQL
Inner Outer. Inner
,
, .
:
_! Inner Join _2
On (_!._!=_2._2)
On ,
.
And ( ), Or ( ) Not ( ).
(<, >, = . .).
,
.
:
From Items Inner Join Storage On (Storage.Item = Items.ItemNo)
From
Items Storage. :
, Item ( Storage) ItemNo (
Items) .
Outer. (
, !
, , !
.
( , NULL). :
From _! Left [Outer] Join _2
On (_1._! = _2. _2)
From _! Right [Outer] Join _2
On (_!._! = _2. _2)
From _! Full [Outer] Join _2
On (_!._! = _2. _2)
/,/?>?-(.>))
, (. .
, ), , ,
_1. , _-
3. ()
165
Where
Where ,
From. .
Where , , . Where
, . , ().
Having.
, Where
. :
! _ !
^
(=, >, < ..) (Between, Exists, In, Like, Is
Null, Some, Any, All). , , SQL.
SQL . And, Or Not.
.
,
. . Between
:
166
Item
,
Storage 0 (.. MI
).
In ,
:
[Not] In (_)
,
. :
( ).
, ,
In, true (false,
Not). In.
// ,
// , In
Select EmployeeNo, LName, FName, MName, Birthday
From Employee
Where (LName In ("", "", ""))
// 11 ,
// 10
Select Items.ItemNo, Category.CategoryNo, Items.Item,
Category.Category, Items.Price
From Items Inner Join Category On
(Category.CategoryNo = Items.Category)
Where (Items.ItemNo In (Select Item From Storage Where Qty <= 10))
Like true. Like.
3. ()
167
% _, ,
. ,
Items, Description 50%.
// Employee ,
//
//
,
, , .
, Where Having .
, Where . SQL,
, .
168
// Items Category,
// Inner Join
Select Items.Item, Category.Category, Items.Description, Items.Pric
From Category Inner Join Items On (Category.CategoryNo = Items.Category)
// Items Category,
// Where
Select Items.Item, Category.Category, Items.Description, Items.Pric
From Category, Items
Where Items.Category=Category.CategoryNo
Group By
Group By
. Group By
, . , Group )
Select. ,
, . ,
Select, ( '
SQL :
Q Avg
, ,
.
Q Count , ;
.
Max, Min (
) , , .
Q Sum , , .
SQL-,
Group By.
Select Category .Category, Sum(Storage.Qty*Items.Price) As Cost
From Category Inner Join Items
On (Category.CategoryNo = Items.Category)
Inner Join Storage On (Items.ItemNo = Storage.Item)
Group By Category.Category
SQL , .
Items, Storage Category. Category . ,
Cost (), Qty ()
Price () , .
Having
Having , , , . Having Group By.
3. ()
169
Having Where. ,
Where , a Having
.
Order By
Order By , . Group By. Order By
, .
Asc,
. Desc, , . , .
, Order By ( ),
Select.
Order By.
Select Category.Category, Sum(Storage.Qty*Items.Price) As Cost
From Category Inner Join Items On (Category.CategoryNo = Items.Category)
Inner Join Storage On (Items.ItemNo = Storage.Item)
Group By Category.Category
Order By Cost Desc
, , ,
.
.
(Delete)
. , . , -
, . :
Delete From _ [Where ]
, From, , , Where. Where ,
. From Where ,
(Select).
,
( ),
, -- ,
.
(Insert)
. ,
Insert, . :
170
(Update)
{
. Update
:
Update _
Set _ = [, _ = ...]
[Where ]
_, , Where. Where ,
. , Set.
. , , Select, .
,
5%.
Update Items
Set Itemsl.Price=Iterns1.Price*!.05
Where Category=4
(Union)
Union , , . :
3. ()
171
: , , . . ,
.
. , Union
. ,
, .
(..
- ),
. , .
, Union.
. , All
,
.
, Where ( ) Set
( ) SQL, . (:) , :
SQL
() () , , .
, . ,
Lower ("Borland") "borland", Upper(" Borland")
"BORLAND".
Substring . :
172
For , ,
. , :
SubstringC'Borland C++ Builder" From 13 For 7)
"Builder". , For.
Trim /
. :
Trim([Leading|Trailing|Both] [] From )
, ,
Leading, Trailing Both.
( ), ,
, . ,
Leading. , .
, :
Trim(Leading "0" From "00099456")
"99456".
Cast .
:
Cast( As _)
.
, . ,
, , .
.
Cast(Quantity As Char(5)).
Extract (, )
Date Timestamp. :
11(_ From )
_ : Day ( ), Month ( ) Year ( ).
Date Timestamp, .
, Extract.
SQL
, .
: ( sql)
qbe ( qbe). (sql
qbe) . sql qbe
. SQL
( ). sql qbe
Database Desktop.
3. ()
173
(DDL)
(Data Definition Language, DDL), SQL, , .
SQL , DDL, Create
Table, Alter Table, Drop Table, Create Index Drop Index.
(Create Table)
Create Table . SQL
:
Create Table _ (_ [, _,...]
[, __])
Create Table ( , )
_. db ( Paradox) /( dBASE). ,
, ,
. .
.
:
_ _.
.
.
. Primary Key.
, .
Items:
174
, ( ,
Create Table). !
( , -).
3.3. , SQL
Smallint
Integer
Decimal[(s[, p])]
. s
.
Numeric[(s[, p])]
Float(s, p)
11
Character(length)
Varchar(Iength)
, 1 254 .
_ _
Date
Time
Boolean
Blob(length, type)
Timestamp
, , .
Money
Autoinc
Bytes(length)
. length
.
Constraint. Constraint
, Primary Key. Paradox dBASE
, , . ,
Constraint -
.
, .
, , , ( ) .
, , Exists /.
,
.
3. ()
175
(Alter Table)
Alter Table .
, . :
Alter Table _ Drop _ | Add _
Alter Table Drop Add.
Drop , . Drop Alter Table . .
Add. Add , Create Table: _ _.
Alter Table Add Drop.
, Alter Table
:
(Drop Table)
Drop Table :
Drop Table _.
(Create Index)
Create Index . :
Create [Unique] [Asc | Desc] Index _
On _ (_! [, _ 2 . . . ] ) .
_
. . , ,
176
. , Paradox
. dBASE , i
.
(.. , , ),
Unique. Asc (Ascending) Desc (Descending)
.
(Asc).
Employee NameNDX
LName, FName MName:
(Drop Index)
Drop Index . :
SQL TQuery.
(SQL Builder)
TQuery, -
. , ( DatabaseName), SQL SQL. , , SQL, ,
, SQL.
TQuery , SQL-.
, ( ),
Active TQuery true, TQuery
, (.. ).
, SQL,
( , ,
DDL),
.
Execute TQuery, ExecSQL:
Queryl->ExecSQL();
SQL ( TString).
, SQL (String List Editor).
SQL.
SQL. ,
OnCreate :
3. ()
177
Queryl->Close() ;
Queryl->SQL->Clear() ;
Queryl->SQL->Strings[0]="Select * From Items";
Query l->SQL->Strings[l]="Whe re Category=l" ;
Queryl->0pen() ;
Items, 1 . ,
Editl Button 1,
:
Queryl->Close() ;
Queryl->SQL->Strings[l]="Where Category="
Queryl->0pen() ;
Edi tl->Text;
, Editl Button 1, , . ,
, Editl
.
, , ,
.., (SQL Builder),
TQuery.
, SQL Builder
TQuery. SQL - SQL-,
SQL Builder , . ,
SQL Builder . , SQL
( , , DDL) . SQL Builder
, SQL.
SQL Builder :
Table Database. , .
Database ,
. , Database <Local Directory>,
.
. TQuery DatabaseName,
Database.
. 3.25. SQL
Builder Items
MyData
Paradox
Items IBLocal
InterBase
ITEMJp.
tern
Category
Price
Items ITEMJp ;
Items^l .Item
ltems_1 .Category
Items 1 .Price
178
, Table
.
, .
. ^
, (_)
, ltems_1 (. . 3.25). !
, )
. : Remove Table Edit Tabh
Alias. ,
().
. , Database
. . 3.25
SQL Builder, Items
MyData Paradox Items IBLocal InterBase.
,
SQL Builder .
: Criteria, Selection, Grouping, Group Criteria, Sorting Joins.
.
, , (. . ). .
. .
Joins . ,
. ,
.
3. ()
179
Having, Sorting.
SQL Builder, .
: , SQL Builder. , ,
SQL Builder, SQL TQuery.
.
Run SQL Query ( ). ,
Show SQL ( SQL ), SQL, SQL '. , SQL Query Text Entry
SQL (. . 3.26).
SQL, .
RequestLive
, TQuery, .
, ,
. ,
( TDBGrid), DataSourcel ( TDataSource).
DataSourcel (), (TQuery),
. ,
Items MyData, SQL TQuery,
MyData, :
180
.
.
DataSourcel TQuery.
, . RequestLive true, ,
. ,
, - TQuery , . CanModify . true, , . RequestLive
false, CanModify &, .
(Select)
.
Select Distinct.
G From Inner Join
Outer Join.
SQL (Sum, Max ..).
, ,
.
SQL .
Q Order By .
RequestLive true, (BDE) , .
,
, .
,
. UpdateObject.
TUpdateSQL.
TUpdateSQL , SQL: DeleteSQL,
InsertSQL ModifySQL. ,
, TQuery.
TUpdateSQL .
SQL TQuery (..
), (
Open Active,
RunSQL), .
: DataSource - Params.
DataSource TDataSource, ( TQuery).
, ,
.
3. ()
I b-r,,|,-.vN , j L'fltHorijry
3
ttemfJo jSem
! *.]
jjdjs?*
^!CeJegciyjDesmpfe |*j
3 VIAKT133A.-- -.-
61 SocketAMenliM-KT133AB
3 V1AKT133A, '/..'.-I
jU
181
3 VlAKT133,Cr' " |
3 V1AKT133A," ,
65iSocketAGIGA-BYTEGA-7ZMMH
3 'VIAKM133A,
68 SocketAASUSA7V133-C
3 VIAKT133A'..;|
. 3.27. CategoryNo ,
,
,
DataSource -.
(TDBGrid) , . 3.27 ( DBGrid2, DBGridl).
TQuery, TTable TDataSource, . DBGrid2 DataSource2, ,
, Tablel. Table 1 Category MyData. ,
CategoryNo Category Tablel.
: DBGridl DataSource 1 Query 1. Query 1
MyData, SQL :
182
Queryl->Prepare();
Queryl->0pen();
Prepare , pt
. BDE
, .
, . ,
UnPrepare ,
.
, (
/ ). ,
, Prepared.
,
, DDL. Active
TQuery true ( Open), SQL
SQL-, .
RunSQL:
Queryl->RunSQL();
, ,
(.. , ).
RowsAffected. 0 ,
. , RowsAffected -1.
TQuery TDataSet.
, . TQuery
, ,
TUpdateSQL.
TUpdateSQL
, ( ),
( ).
TUpdateSQL.
, ; , ,
. ,
, ,
. ,
TUpdateSQL, . -
3. ()
, TUpdateSQL
.
, . , . , .
TUpdateSQL
Borland C++ Bulder 6. , , TQuery,
TUpdateSQL.
( , , ), (
, , , ).
.
(DBGridl), TQuery (Queryl), TDataSource (DataSourcel) TUpdateSQL (UpdateSQLl). DBGridl DataSourcel, ,
, Queryl. Queryl ()
MyData SQL :
SELECT StoreltemNo, Item, Qty, Description
FROM Storage
Active Queryl,
CachedUpdates true, .
. , . CachedUpdates /a/se, UpdateObject Queryl UpdateSQLl.
.
. Queryl , CachedUpdates true.
.
, UpdateSQLl .
, TUpdateSQL. VCL
TDBGrid (DBGridl), TDataSource (DataSourcel), TQueryl (Queryl)
TUpdateSQL (UpdateSQLl). DBGridl, DataSourcel Queryl
. DatabaseName Queryl
MyData, SQL :
SELECT CategoryNo, Category, Description
FROM Category
Category ( ).
RequestLive false.
. UpdateObject
UpdateSQLl, CachedUpdates true.
RequestLive false, ,
Queryl, .
.
, .
184
-
TUpdateSQL. UpdateSQl
Editor UpdateSQLl (
UpdateObject Query 1). TUpdateSQL
Options. Tablt
Name ( ), Key Fields ( ) Update Fields ( )
Table Name , Queryl.
Get Table Fields BDE, Key Fields Update
Fields (. . 3.28). Key Fields
, . . ,
. . Update Fields , . ( Shift Ctrl).
: !
i
Category - :Cetegory.
Description * Description
,:,:;.
Can
ColegoryNo :OLD_CategcryNo
~1
. 3.29. SQL TUpdateSQL
, KeyFields, . , .
CategoryNo. Update Fields
,
3. ()
185
//Modify
Update Category
Set
Category = :Category,
Description = description
Where
CategoryNo = :OLD_CategoryNo
//Insert
Insert into Category
(Category, Description)
Values
(:Category, description)
//Delete
Delete from Category
Where
CategoryNo = :OLD_CategoryNo
,
TDBNavigator, DataSourcel, TButton.
Apply Updates :
Queryl->ApplyUpdates();
Queryl->CommitUpdates();
Cancel Updates
:
Queryl->CancelUpdates()
186
() ,
.
,
Category, , RequestLive false (.. ).
Apply Updates.
, Cancel Updates. - . 3.30.
1
2
3
4
5
: ,
Intel AMD
Intel. Arnd VIA
DIMM, DIMM DDR RIMW
7 -
- -
8
Fujitsu, Samsung Wettern Digital
9 , , ...
10
, , 4
11
.
12
1|..
. 3.30. ,
TUpdateSQL.
, , ,
( ) ,
. ( SQL-92), TUpdateSQL.
TUpdateSQL - ,
. .
, , , , , .
, Items, Category Storage.
, RequestLive true. ,
, ,
.
,
TDataSource TQuery. , TUpdateSQL,
Storage ( Qty) Items ( Price).
, . DataSourcel,
DataSourcel . Query 1. Query 1, ,
MyData SQL :
SELECT Category.Category, Items.Item, Items."Index",
Items.Price, Items.ItemNo, Storage.StoreltemNo
Storage.Qty,
3. ()
187
UpdateSQLl->DataSet=Queryl;
UpdateSQL2->DataSet=Queryl;
, , , , UpdateObject TQuery .
TUpdateSQL. , UpdateObject UpdateSQLl (UpdateSQL Editor)
Options. Table Name Items Get
Table Fields. Key Fields ItemNo, Update Fields Price.
Generate SQL SQL. Modify :
Update Items
Set
Price = :Price
Where
ItemNo = :OLD_ItemNo
SQL Insert Delete , .
, Beforelnsert BeforeDelete. :
Abort();
-
188
Query 1.
UpdateSQL2.
UpdateObject Query 1 UpdateSQL2. cm
Table Name Storage Get Table Fields.
Key Fields StoreltemNo, Update Fields Qty. :
Generate SQL SQL. ;
( Modify) :
Update Storage
Set
Qty = :Qty
Where
StoreltemNo = :OLD_StoreItemNo
, , .
UpdateObject Query 1. ;
.
OnUpdateRecord Query 1. *
ExecSQL, Apply. , :
if(Updateind == ukModify)
UpdateSQLl->Apply(UpdateKind);
UpdateSQL2->Apply(UpdateKind);
UpdateAction=uaApplied;
>
, , . OnUpdateRecord
- UpdateAction uaApplied,
.
, , .
TDBNavigator TButton, , .
UpdatesPending , :
void
{
if((Queryl->CachedUpdates) && (Queryl->UpdatesPending))
{
switch(Application->MessageBox(
" ! ?",
"!", MB_YESNOCANCEL + MB_ICONQUESTION))
{
case IDYES:
{ Queryl->ApplyUpdates();
3. ()
189
Queryl->CommitUpdatesQ ;
break; }
case IDCANCEL:
{ CanClose=false; break; }
case IDNO:
{ Queryl->CancelUpdates(); break; }
. ,
(: . 3.31).
"1-1 '1 .
.!j
Gb Fujitsu MNN21
70101
60101
60102
Semsung 1 51 E
60002
Semsurigl 61 8M
Samsung 1 51 i.297
J60001
Samsung 550E
^ 60105
Samsung 561 S
jcmtron 56E
:60103
'BOQOI
16")Senisung753DFX
61105
601 01
10
56
61103
"*
l^j -;-
98.00S *^;
13.00$"- *':||
16.0DS
;. \':
9400$ ;
99
12.00$
86 '
8700$iV-:";"!
37.
^0.00$ -"-
98 :
$ ;
|
19.00$ ';
35
"" 69'""
!61,OQJ X:\*j$.
26
6400$ '^i'l
$"::";;.:
. 3.31. -,
TBatchMove
TBatchMove TComponent.
TBatchMove . :
;
;
Q ;
Q .
TBatchMove Source Destination. :
property TBDEDataSet* Source = {read=FSource, write=SetSource};
property liable* Destination = {read=FDestination, write=FDestination};
, Destination
( ), Source
TBDEDataSet (, TQuery, TStoredProc). , -
190
, !
, .
TBatchMove Mode.
, (),
Destination. TBatchMode.
Q batAppend Source Destinaton
.
Q batAppendllpdate - (Destination).
- ,
. (Source), , (Destination).
G batCopy (Source)
(Destination). (. . ) , , .
G batDelete (Destination),
(Source). , BDE
. ,
. ., , , MS
Access, , , , SQL.
Q batUpdate (Destination)
(Source).
Mappings TBatchMove. TStrings*
( ). :
=
,
.
TBatchMove
. , TBatchMove
. .
G AbortOnKeyViol . true (
), ,
. false, , , .
, KeyViolTableName.
Q AbortOnProblem . true,
- -
3. ()
. false ,
,
ProblemTableName.
Q ChangedTableName AnsiString
Paradox, ,
, - .
Q CommitCount . , .
Q RecordCount , , .
Q KeyViolTableName ProblemTableName , , .
, .
TBatchMove , , .
: BDE
TBatchMove . , ,
. , ,
TQuery.
, TBatchMove
.
TDBGrid, TDataSource, TQuery, TTable TBatchMove.
. DBGridl DataSourcel, a DataSourcel Query I. Query 1 MyData,
SQL :
Select Items.Item, Category.Category, Storage.Qty, Items.Price,
Storage.Qty*Items.Price As Cost
From Items
Inner Join Category
On (Category.CategoryNo = Items.Category)
Inner Join Storage
On (Items.ItemNo = Storage.Item)
SQL, ,
Cost.
. , OnCalcFields :
Query!->FieIdByName("Cost")->AsCurrency =
Query!->FieldByName("Pri")->AsCurrency *
Query!->FieldByName("Qty")->AsInteger;
, Active Queryl true.
, , . .
, TableName Table! Report (
), Mode BatchMovel batCopy.
192
-, (
TButton),
(OnClick) :
Queryl->Close();
BatchMovel->Execute();
DataSourcel->DataSet=Tablel;
Tablel->0pen();
Query 1.
, BatchMovel. ]
DataSourcel Tablel
.
.
, . , TBatchMove
(. . 3.32).
440001
sHPLeserJetl220
2;
080 OOt
tttttttt
I HP LaserJet 3200
86:
637.00t 61.152001
mum
IHP LaserJet 2200
86
761.001 66.968 OOt
Hew'
> HI
"j
. 3.32. TBatchMove
#
, , , MyBase.
.
. ,
. ,
. ,
.
, , , . , , ,
, xml cds,
.
.
, MyBase . , -
3. ()
, .
, , ,
. . , ,
.
MyBase BDE TClientDataSet
TBDEClientDataSet. .
C++ Builder,
TClientDataSet TBDEClientDataSet.
TClientDataSet , ProviderName TProviderName, , ,
(, ,
). Assign Local Data TClientDataSet.
TProviderName. . TClientDataSet
TDataSource . Load from MyBase table
.
, TClientDataSet
. Clear Data .
Save to MyBase Xml table, Save to MyBase Xml UTF8 table Save to binary
MyBase file .
xml,
cds.
ApplyUpdates.
BeforeApplyUpdates ( , ).
CancelUpdates.
TBDEClientDataSet DBConnection CommandText. DBConnection
TDatabase. CommandText
SQL. TBDEClientDataSet
. FileName
xml cds CommandText , .
.
BDE.
,
TQuery.
TDBGrid () .
7 . 319
194
TQuery ]
SQL. , SQL,
SQL TQuery.
, (
TSession) ( TDatabase).
, TUpdateSQL (
), TBatchMove ( ),
( TClientDataSet TBDEDataSei).
- IBConsole
ISQL
Interbase
(Embedded) SQL
Interbase
Interbase
dbExpress,
Interbase Express ADO.
(unidirectional) dbExpress
TSQLClientDataSet
TSQLMonitor
- ( , ),
, .
, , , , . ,
, .
, .
.
Borland C++
, Interbase, Informix,
Microsoft SQL Server, DB2, MySQL Oracle, ODBC .
, ,
SQL dbExpress, IBExpress ADO (dbGo).
. , Interbase
SQL. Interbase . -,
, ,
(.. SQL). -, Interbase C++ Builder ( Enterprise Edition
196
7 ( 5)), *
. , C++ Builder Enterprise Professions
Interbase (Interbase Desktop Edition). >
Interbase Desktop Edition, !
, .
, ..
. cef
, Interbase.
, , Interbase ( 6.5).
Interbase
Interbase Windows (system traj
.
InterBase Guardian. ,
Interbase. , InterBase Guardian
- . Interbase ,
. InterBase Guardian
,
Shutdown.
, ibguard.exe,
Bin , Interbase.
InterBase Guardian, Interbase.
ibserver.exe,
Bin , Interbase.
. , !
InterBase Guardian, , npi
.
, \
\ .
. !
InterBase Guardian.
. ,
InterBase Guardian .
, InterBase Guardian, Interbase , , .
4. -
Interbase
(IBConsole)
197
'$ IBConeole
!.,<,>,. 1/
Interbase, ,
- ,
( , Windows ISQL).
Interbase \
| Interbase.
. 4.1. IBConsole
ibconsole.exe',
Bin ,
Interbase.
, ( )
(. . 4.1). , (Connections Tree), (, , ,
..). Connection
Tree , , . ,
,, : ,
, , ..
IBConsole
InterBase Servers. . I Register Server and i
,
Server Information
.
Register...
Demote Server;
I* Local.Server
Server
Network Protocol:
Server Name: _
(InterBase
Servers).
Register
Ajias Name:
Server and Connect.
Description:
,.-:
Local Server (. . 4.2).
[
(User Name), (Password)
W Save Alias Information
. SYSDBA, masterkey.
Login Information
.
User Name: SYSDBA
,
Password:
(Login).
Cancel
Register Server and Connect
;);-^rv--. ~
Remote
Server (. . 4.3).
. 4.2.
198
Bemcrte Server
Server Name:
|lB6Server
Local Setver
- Database^
Jetwork Protocol:
(TCP/IP
file.
Alias Name:
;B6
employee.gdb
ANas Name:
F Save Alias Information
Qescription:
(
:
. 4..
. 4.4.
,
(, SYSDBA masterkey), .
.
, ,
(Local Server ), ,
. (Databases), (Sertiftcates) (Users). ,
Backup Server Log.
(Backup) (Restore). Server
Log Log- .
Logout Server ,
. ,
. Login Server,
Un-Register .
4. -
199
Page 'Size
Default Character Set
SQL Dialect
listens
JTest
|
I
OK
Cancel
200
( ,
, SQL).
.
Register database ,
(
), , .
Disconnect Unregis
. Register (. . 4.4
Connect Connect As.
.
Interbase. ( )
, (Action),
. - , ]
.
(..
), (. . 4.6).
(Tables), (Indexes), (Views), (Domains),
(Stored Procedures), (External Functions),
(Generators), (Exceptions), Blob- (Blob Filters) (Roles). Cnncoi
,
SQL.
^Console
:
^ '
*
-
loots
'
.
Name
COUNTRY
CUSTOMER
DEPARTMENT
EMPLOYEE
EMPLOYEE_PROJECT
g
.,,,.,
^
^
,.
Owner
Description
SYSDBA
SYSDBA
SYSDBA
SYSDBA
SYSDBA
SYSDBA
ITEMS
SYSDBA
JOB
SYSDBA
PROJECT
PROJ_DEPT_BUDGET SYSDBA
SALARY_HISTORY
SYSDBA
SALES
SYSDBA
<\
1 '1 1
. 4.6. employee.gdb
, , -
4. -
201
j(
ITEM_ID
SPEC_ID_REF
INTEGER,
CURRENCY_ID_REF
ITEH
IHTEGER,
OARCHAR(IOO) ,
DISCOUNT
NUMERICH, 2),
| PRIMARY KEY (ITEM_ID)
I);
I SET TERH ;
.1 *
(Modified i
. 4.7. Items employee.gdb
Interbase .
SYSDBA, masterkey.
Interbase SYSDBA.
Users .
Users, Interbase
. SYSDBA Users Modify User. Password
Confirm Password. , .
Users . Add User
, Delete User
. ,
SYSDBA. , .
202
Interbase
.
(,
), Interbase.
,
Add Certificate
Certificates. ID
.
ISQL
ISQL ( Interactive SQL) ,
Interbase, ;
. , ]
ISQL. , ISQL
SQL Interbase. ,
.
, , , ,
Borland (www.borland.com).
Interbase, ISQL. . , ,
- .
ISQL ,
Interbase. ISQL Interactive SQL Tools
. ISQL - , .
,
, ,
( SQL). , ( Execute
Query). , Connect,
.
ISQL (. 4.8). SQL.
(DDL) (DML). Execute Query (
) Execute Query ( Ctrl + ).
Prepare, , .
ISQL
SQL. Previous Query ( ) Next Query ( ) . ,
, . SQL, ISQL,
4. -
;| Interactive SQL- employee.qdb
Edit, Quety
Database
? - ?0 - 9? 1 ,
Transactions Windows
Help
203
r 10
j Statistics)
. 4.8. ISQL
2 04
Interbase
Interbase, , , SQL,
. ,
: Interbase ,
, . , ,
Interbase gdb. ,
Interbase,
, Interbase.
, - , . - SQL ,
.
, ,
Interbase.
, Interbase
, Interbase, , . Interbase
. .
Blob. Binary Large Object ( ). , ,
, .
Blob, , .
Blob : 0 ( ), 1 (), 2 ( ), 3 (
), 4 (), 5 (
), 6 ( ,
, ). 2 6 , 0 1. .
( -32 678
-1). Interbase.
Blob , 64 ,
. 64- ,
Blob (Blob ID). , Blob ID
, Blob.
CHAR(n) CHARACTER(n). .
1 32 767 .
Q DATE. 1 100
29 32 768 . 32 .
Q 1(, ). .
(
), . , DECIMAL(5,2) ddd.dd.
4. -
205
, . , ,
. 1 18,
0 18. ,
.
16, 32 64
. ,
, Interbase.
DOUBLE PRECISION. ( IEEE),
15 . ( ): 2.225 10-38
1.797 10308. 64 .
Q FLOAT. ( IEEE), 7 . ( ): 1.175 -38 3.402 3^. 32 .
Q INTEGER. , 32 ( ).
: -2 147 483 648 2 147 483 647.
G NUMERIC (, ). DECIMAL, , ,
.
Q SMALLINT. , 16 .
: -32 768 32 767.
TIME. 00:00:00.0000 23:59:59.9999.
32 .
Q TIMESTAMP. , , . 64 .
DATE TIME, .
Q VARCHAR(n), CHAR VARYING(n), CHARACTER VARYING(n). . ,
. 1 32 765.
SQL
Interbase SQL, , , , SQL.
SQL, Interbase, SQL.
( ) .
: Interbase SQL ( SQL,
) (1, 2 3). SQL
(Embedded SQL) SQL,
. SQL (Dynamic SQL,
DSQL) . DSQL
Interbase, . SQL , 1SQL.
SQL, SQL.
206
, 1
SQL, Interbase 5.6 . 3
SQL-92 . 2
: ,
, 3. .
3, . :
Interbase.
SQL
.
, .
(|). ,
- , (<>).
.
, SQL
, . :
CREATE {DATABASE | SCHEMA} ''
[USER '' [PASSWORD '']]
[PAGE_SIZE [=] ]
[LENGTH [=] [PAGE[S]]]
[DEFAULT CHARACTER SET ]
[<>];
DATABASE,
SCHEMA. .
,
.
.
. <>.
USER PASSWORD , , .
, . 8
. :
4. -
207
, .
, .
: 1 024,2 048,4 096 8 192 . PAGEJSIZE , 4 096
. ,
Backup,
Restore. Restore .
8 192 :
CREATE DATABASE 'D:\Data\MyData.gdb'
USER ' S Y S D B A ' PASSWORD ' m a s t e r k e y '
PAGE_SIZE 8192
LENGTH.
, . , . , .
, .
.
:
<> = FILE ''
[<>]
[<>],
208
, ,
. Interbase , .
, SQI
, DEFAULT CHARACTER SET .
. Oi
, CHAR, VARCHAb
BLOB ( text), a >
.
Data Definition Guide, 13.
, , DEFAULT
CHARACTER SET NONE.
ALTER DATABASE:
ALTER {DATABASE | SCHEMA}
ADD <>;
<> ;
, CREATE
DATABASE. ALTER DATABASE .
, , SYSDBA
, . SQL ( ) :
' MyData.gdb
CREATE DATABASE 'D:\Data\MyData.gdb'
USER 'SYSDBA' PASSWORD 'masterkey';
'
ALTER DATABASE
ADD FILE 'E:\Data\MyDatal.gdb' STARTING AT PAGE 25001
ADD FILE 'E:\Data\MyData2.gdb' STARTING AT PAGE 25001
ALTER DATABASE . , 8 000
,
ADD FILE 'E:\Data\MyDatal.gdb' STARTING AT PAGE 5001
, , 8 001 ( 5 001).
, ( Backup), ( Restore),
.
. -, (Shadow). ,
. , , . (,
)
. CREATE SHADOW.
( DROP SHADOW).
Interbase.
4. -
209
DROP DATABASE. ,
, ISQL.
.
(Domains)
,
, . (Domain)
, .
typedef C/C++.
, .
CREATE DOMAIN.
:
CREATE DOMAIN [AS] <>
[DEFAULT { | NULL | USER}]
[NOT NULL]
[CHECK (<>)]
[COLLATE ];
.
.
(CHAR, VARCHAR, BLOB),
( CHARACTER SET). .
' VARCHAR 15 ; - WIN1251
CREATE DOMAIN FIRSTNAME AS VARCHAR(IS)
CHARACTER SET WIN1251;
' VARCHAR 20
' 1 3
CREATE DOMAIN EMPLOYEE AS VARCHAR(20)[1:3];
' BLOB, TEXT; - 120
CREATE DOMAIN DESCRIPTION AS BLOB SUB_TYPE TEXT
SEGMENT SIZE 120;
DEFA ULT , , . , NULL USER.
USER, . .
NOT NULL, , , . DEFAULT, NULL.
CHECK , . <> ,
:
210
|
|
|
|
|
|
', ,
' 1 12
' - ()
CREATE DOMAIN MONTHNO AS SMALLINT
DEFAULT 1
CHECK(VALUE BETWEEN 1 AND 12);
' , 8
CREATE DOMAIN PHONE AS VARCHAR(IS)
CHECK(VALUE STARTING WITH '8');
'
CREATE DOMAIN ITEMNO AS INTEGER
NOT NULL
CHECK(VALUE > 0);
ALTER DOMAIN:
ALTER DOMAIN { | } {
[SET DEFAULT { | NULL | USER}]
| [DROP DEFAULT]
| [ADD [CONSTRAINT] CHECK (<>)]
| [DROP CONSTRAINT]
| TYPE
};
, CREATE DOMAIN.
ALTER DOMAIN
, , CHECK , .
DROP DOMAIN:
4. -
211
DROP DOMAIN
, ,
.
CREATE TABLE:
CREATE TABLE [EXTERNAL [FILE] '']
(<> [, <> | <0> . . . ] ) ;
. , .
:
<> = { |
COMPUTED [BY] (<>) | }
[DEFAULT { | NULL | USER}]
[NOT NULL] [<>]
[COLLATE ]
. , . ,
, ( ) ,
, . DEFAULT , COLLATE,
, , NOT
NULL, . , . ,
NOT NULL, , .
, . . , .
CHECK VALUE ( VALUE ). AS ( ). , .
COMPUTED [BY] ( BY , ).
, .
, Interbase
, .
.
, - .
, CREATE TABLE .
.
' ,
CREATE DOMAIN EmpNo AS INTEGER CHECK(VALUE > 0) NOT NULL;
CREATE DOMAIN FirstName AS VARCHAR(IS) ;
212
EmpNo
LastName
FirstName
MiddleName
Name
Birthday
HireDate
FireDate
EmpNo,
LastName,
FirstName,
MiddleName,
COMPUTED BY (FirstName || ' ' || LastName),
DATE NOT NULL,
DATE DEFAULT 'Now' NOT NULL,
DATE
);
'
CREATE DOMAIN Price AS NUMERIC(8, 2)
DEFAULT 0;
CREATE DOMAIN Qty AS SMALLINT
DEFAULT 0;
' Storage .
' , .
CREATE TABLE Storage
(
);
StoreNo
Item
Qty
Price
Cost
<> ,
, . , ,
, ,
, . , .
<> :
<0>=[CONSTRAINT ]
(UNIQUE | PRIMARY KEY}
CONSTRAINT . CONSTRAINT , Interbase
, INTEG_10.
RDBSRELATION CONSTRAINTS.
4. -
213
214
CASCADE !
.
CHECK ,
.
,
' PKeyField
' ,
' FKeyField -
CREATE DOMAIN PKeyField AS INTEGER
CHECK(VALUE > 0) NOT NULL;
CREATE DOMAIN FKeyField AS INTEGER
CHECK(VALUE > 0) NOT NULL;
'- Category
CREATE TABLE Category
(
CategoryNo
PKeyField,
Category
VARCHAR(25) NOT NULL,
Description VARCHAR(50),
PRIMARY KEY (CategoryNo),
UNIQUE (Category)
);
Category
FKeyField,
Description VARCHAR(100),
Itemlndex
VARCHAR(S) NOT NULL,
Price
CONSTRAINT
ItemsToCategory
);
, Interbase, . :
4. -
215
. ,
:
CREATE TABLE MonList EXTERNAL FILE ' D : \ D a t a \ M o n L i s t . t x t '
(
Nmon
CHAR(2),
NameMon
CHAR(12),
EOL
CHAR(2)
);
MonList.txt , ( ). .
Interbase, (,
). Interbase,
() Interbase .
. ,
, .
. ,
, - .
.
.
ALTER TABLE. ,
, ,
, , . ,
, ,
. , . :
ALTER TABLE . ,
.
ALTER TABLE:
A L T E R TABLE < 0 > [, <0> . . . ] ;
<> :
Q ADD <> . , .
CJ ALTER [COLUMN] <> . <> :
<> = {
| TYPE
| POSITION }
Q DROP .
216
G DROP CONSTRAINT .
DROP TABLE:
DROP TABLE
(), , .
DROP DATABASE, ,
, , .
.
, , ,
, , .
- . , ,
. , , ,
, .
.
,
:
G ,
;
. ;
Q ORDER BY .
, , :
;
;
Q .
Interbase 64 . ,
Interbase ( ),
, , ( UNIQUE).
CREATE INDEX.
:
CREATE [UNIQUE] [ASCfENDING] | DESCENDING] ] INDEX
ON ( [, . . . ] ) ;
, Interbase ,
.
4. -
217
, , . UNIQUE,
() . , .
ASC , DESC .
, (ASC).
ENDING. ItemNDX Items Item:
CREATE UNIQUE ASC INDEX ItemNDX ON I terns(I tern);
Items ItemNDX ( ItemNo) ( Category) .
ALTER INDEX (, !) . :
ALTER INDEX {ACTIVE | INACTIVE};
ACTIVE ,
INACTIVE . ,
, , .
, . .
:
DROP INDEX ;
, CREATE INDEX. , Interbase
, ,
DROP INDEX .
(Generators), (Triggers)
(Stored Procedures)
. ,
. Interbase
, . , , .
(Generator) , ,
(, )
.
. , , ,
, .
, .
, , , . , :
218
CREATE GENERATOR ;
, 0.
, GEN_ID, :
6_(, ) ;
GEN_ID . ,
, , . .
GEN_ID ,
, INSERT, UPDATE DELETE. ,
Category ,
:
4. -
219
SET
GENERATOR:
SET GENERATOR ;
:
CREATE GENERATOR Category_Gen;
SET GENERATOR Category_Gen TO 1000;
:
Category _Gen
1001.
31
31 64- -2 10 2 10 1.
, , , , ,
(NUMERIC DECIMAL). ,
, INTEGER.
, . (Trigger) .
, (View). ,
. . .
CREATE TRIGGER:
CREATE TRIGGER FOR { | }
[ACTIVE | INACTIVE]
{BEFORE | AFTER} {DELETE | INSERT | UPDATE}
[POSITION ]
AS <>
CREATE TRIGGER , . , ( ), , ,
. , Interbase,
BEGIN... END.
ACTIVE INACTIVE.
,
. A C T I V E . INACTIVE .
, .
: , , , ,
. , BEFORE INSERT, , ,
( ).
. ,
POSITION. .
, .
220
POSITION 0, ; ,
POSITION 1, ..
CREATE TRIGGER SQL
(DSQL), ISQL. , , .
(), , ISQL.
SET TERM:
SET TERM
, ISQL.
. , :
SET TERM ;
[]
END;'
:
DECLARE VARIABLE ;
Interbase. (INSERT,
UPDATE, DELETE SELECT), SQL,
(UDF User-Defined Functions). , :
, .
EXECUTE PROCEDURE, .
, ,
WHEN, .
OLD NEW, , ,
. .
Q .
:
4. -
221
, ELSE,
. ELSE ,
. ,
BEGIN END.
FOR SELECT... DO:
FOR
<_5!_>
DO
<>;
SELECT ,
, () INTO. SELECT,
(UNION). INTO ,
( ).
INTO. , INTO,
, SELECT.
, DO.
FOR SELECT... DO . , SELECT, , INTO.
, DO.
FOR SELECT... DO.
ItemNo, Item, Qty Notes , , . DO Qty ( )
Notes .
FOR
END
:
WHILE
(<>) DO <>
, DO, ,
TRUE.
222
EXECUTE PROCEDURE :
:
EXECUTE PROCEDURE [TRANSACTION )
[: [ [INDICATOR] : ] ]
[, : [ [INDICATOR] : ] ...]
[RETURNING_VALUES : [ [INDICATOR] :]
[, : [ [INDICATOR] : ] . . . ] ] ;
, (input)
(output) .
RETURNING VALUE:
EXCEPTION ,
CREATE
EXCEPTION:
CREATE EXCEPTION
WHEN. :
4. -
223
' ,
'
' ,
CREATE TRIGGER Set_Category FOR Category
ACTIVE BEFORE INSERT
AS
BEGIN
NEW.CategoryNo=GEN_ID(Category_Gen,l);
END
' Invoice ( ) ,
' Invoice_Gen,
' No. CAST
'
CREATE TRIGGER SetlnvoiceNo FOR INVOICES
ACTIVE BEFORE INSERT
AS
BEGIN
NEW.Invoice='No ' || CAST(GEN_ID(Invoice_Gen,1) AS VARCHAR(G));
END
. ,
BEGIN END, .
, , , ,
. .
IBConsole, , (,
..). , , ( Properties
, Metadata).
ALTER TRIGGER.
CREATE TRIGGER.
DROP TRIGGER .
,
, (Stored Procedure). ,
, . ,
SELECT.
CREATE PROCEDURE, , , DSQL ISQL:
CREATE PROCEDURE
[( [, . . . ] ) ]
[RETURNS ( [, . . . ] ) ]
AS
<>;
224
(input) (output) . .
RETURNS. .
, (, , ) ,
, SaleDate, !
:SaleDate.
, , ,
Interbase. :
OLD NEW. , , :
(SELECTProcedures) (Executable Procedures).
,
, .
, . SELECT.
SQL, , .
,
ISQL:
SET TERM
(
ItemNo INTEGER,
Item VARCHAR(50),
Qty SMALLINT,
Notes VARCHAR(20)
)
AS
BEGIN
FOR
DO
BEGIN
Notes='';
IF (Qty 5) THEN Notes='Cp04HO !';
IF ((Qty >= 5) AND (Qty 10 THEN Notes='!';
SUSPEND;
'
4. -
225
END
END
SET TERM ;
SELECT,
Items Storage. ItemNo, Item, Qty Notes, RETURNS. DO Qty (
). 5, Notes '
!'. 5, 10, Notes '!'. Notes " ( ).
(TDBGrid), OnDrawColumnCell, , ,
Notes (. 3).
SUSPEND.
. ,
SUSPEND ,
. , SELECT
, ,
INTO. , , , SUSPEND.
SUSPEND
.
. SUSPEND
DO, , Notes
. SUSPEND END,
. , , SUSPEND ,
.
(Executable) - . ,
. ,
( ) - . ,
, .
SQL: , .
()
.
, .
,
.
CREATE PROCEDURE Get_Emp_Gen
RETURNS(NumCode INTEGER)
AS
BEGIN
NumCode=GEN_ID(Emp_GEN,l);
END
8 . 319
226
,
. :
TQuery (BDE) TSQLQuery (dbExpress),
: TStoredProc (BDE) TSQLStoredProc (dbExpress).
BeforePost
:
GetEmpGen->ExexProc() ;
EmpNoField->AsInteger=GetEmpGen->ParamByName("NumCode") ->As Integer;
, Employee. .
(Views)
. . , , ,
, . Interbase ( SQL)
(View). ( )
.
. , , ,
..
4. -
227
, ( ). .
. ,
, .
. ,
. , , , .
, ,
, .
, . . ( ) , .
, ,
,
. ,
.
,
, .
. ,
(, , , ).
,
. , , , . , , .
CREATE VIEW:
CREATE VIEW
[( [, . . . ] ) ]
AS <0neparop5elect> [WITH CHECK OPTION];
, ,
OmpamopSelect. SQL . SELECT FROM,
WHERE. ORDER BY.
UNION [ALL].
, ISQL .
. , .
, SELECT. , -
228
. , *
, SELECT.
;
, .
KOI
WITH CHECK OPTION.- , of
, ,
. , , . }
.
WITH CHECK OPTION,
- .
.
' Employee
CREATE VIEW ViewEmp ( EmployeeNo, LName, MName, FName,
HireDate, FireDate, Birthday, Description)
AS
SELECT * FROM Employee;
' StoreView
'
'
CREATE VIEW StoreView (ItemNo, Item, CategoryNo, Category,
Description, Itemlndex, Price, Qty, Cost, Notes)
AS
SELECT Items.ItemNo, Items.Item, Category.CategoryNo,
Category.Category, I terns.Description,
Items.Itemlndex, Items.Price, Storage.Qty,
Storage.Qty*I terns.Price, Storage.Notes
FROM Category
INNER JOIN Items
ON (Items.Category = Category.CategoryNo)
INNER JOIN Storage
ON (Storage.Item = Items.ItemNo);
.
, , , ,
.
, , .
,
.
, , ,
. . -, , .. -
4. -
229
. ( .)
-, .
: WITH CHECK OPTION.
Interbase ALTER VIEW,
, ( DROP VIEW
), ( CREATE VIEW).
(Exceptions)
Interbase, .
, . ,
.
, .
, . CREATE EXCEPTION:
CREATE EXCEPTION '';
78 . ALTER EXCEPTION, a
DROP EXCEPTION. ,
- , .
,
.
EXCEPTION.
:
IF () THEN EXCEPTION ;
(
WHEN... DO):
Q , ;
G , ;
Q ,
.
. WHEN... DO.
EXCEPTION ,
WHEN, :
WHEN EXCEPTION DO
BEGIN
END
,
WHEN EXCEPTION... DO.
230
, , . ,
BEGIN... END WHEN. , ,
.
WHEN :
WHEN
{EXCEPTION | SQLCODE ^ |
, Interbase,
, . ,
, . ()
SYSDBA. (Creator) (Owner) ,
. SYSDBA ,
.
GRANT, :
GRANT {ALL [PRIVILEGES] | <>}
ON [TABLE] { | }
{<0> | <> | GROUP TpynnaUNIX};
,
:
Q SELECT ;
Q DELETE ;
Q INSERT ;
Q UPDATE [( [, ...])] ;
REFERENCES [( [, ...])]
.
, ALL.
4. -
ON [TABLE] ,
. ,
. <>
, . :
Q PROCEDURE ;
TRIGGER ;
VIEW ;
Q PUBLIC - ,
, , , (
).
, . ([USER] )
UNIX (). ,
UNIX.
WITH GRANT OPTION.
.
GRANT.
' Accountant!
' Orders,
'
GRANT ALL ON Orders TO Accountantl WITH GRANT OPTION;
' Accountant2
'Orders Client Quantity
GRANT SELECT, UPDATE(Client. Quantity) ON Orders TO Accountant2;
' AddEmp
' Employee
GRANT INSERT ON Employee TO PROCEDURE AddEmp;
GRANT .
:
GRANT EXECUTE ON PROCEDURE
TO {<0> | <>}
,
GRANT .
Interbase, (Role).
, . , , ,
( ), ,
. , BookKeeper, .
- , :
232
CREATE ROLE ;
DROP ROLE ;
//
//
,
GRANT, :
GRANT <> ON [TABLE] { | }
;
/ (SELEC1
INSERT, UPDATE, DELETE, REFERENCES) ANY. (
.
:
...]} }
GRANT
. ,
.
PUBLIC. ( )
.
WITH ADMIN OPTION, ,
(), , , (
()).
, GRANT,
REVOKE:
SQL
( , InterBase), . - ,
4. -
233
.
.
dbExpress ( C++ Builder 6);
ADOExpress IBExpress.
BDE .
dbExpress ( dll), SQL.
dbExpress
(Vendor Library). dbExpress , dbexp . : dbexpdb2.dll
( DB2), dbexpint.dll ( Interbase), dbexpora.dll ( Oracle).
. , Borland C++
Builder (Enterprise Edition)
(DB2, Informix, Interbase, MySQL, Oracle). ,
DB2 db2cli.dll, Interbase gds32.dll,
Oracle ocldll. dbExpress (LibraryName)
(VendorLib) dbxdrivers.ini.
dbExpress, -, . ,
() ( Informix).
dbExpress Linux, .. - ( CLX).
5, C++ Builder Interbase
Express (IBExpress).
Interbase. Interbase
( , , , .. IBExpress), C++ Builder
6 Interbase (
Interbase Admin): , , ,
.. Interbase Admin ,
Interbase 6 .
, ,
Interbase.
C++ Builder ADO (ActiveX Data Objects), Microsoft. ADO OLE DB, , .
C++ Builder , ADO,
ADOExpress, dbGo.
ADO ,
Microsoft Access Microsoft SQL Server (
Microsoft).
234
dbExpress
dbExpress
TSQLConnection. ;
dbExpress (,
TSQLClientDataSet). j
SQL, TSQLConnectio
ConnectionName, DriverName, GetDriverFunc, LibraryName VendorLib. Ho npi
Edit Connection Properties
TSQLConnection. dbExpre.
Connections (. 4.9).
f;
Driver Name
Connection Settings
lnterbase
Key _
.Lvalue.
Drive rName
ilnterbase
Database
: d:\data\MylBData.gdb
RpleNarne
yser_Name
sysdba
Password
masterkey
None
SeryerCriarSet
SQLDialect
3"
BlobSize
-1
CommitRetain
False
IWaitOnLocks
True
ErrqrResqurceFil6:D:\MylBData\MylBData.err
LocaleCode
iOOOp
Interbase TranslstReadCommited
Connection Name
JIBConnection
Cancel
Hep
4. -
235
Connection Name
MylBConnect
OK
Cancel
htelp
. 4.10.
Add Connection dbExpress Connections Delete Connection ( ), Rename Connection
( ), Test Connection ( ) View Driver settings ( : dbExpress/ {Library
Name/Vendor Library)).
, .
ConnectionName, DriverName, GetDriverFunc, LibraryName VendorLib
TSQLConnection .
Connected true , ,
.
Params,
. Params , (Value List editor).
, .
TSQLConnection .
KeepConnection TDatabase
BDE. false, , , ( TSQLConnection). LoginPrompt false,
.
, ( Params).
LoadParamsOnConnect. true
, ( DriverName Params)
dbxconnections.ini TSQLConnection
.
236
dbxconnections.ini (, -(
). , *
LoadParamsFromlniFile:
void _ fastcall LoadParamsFromIniFile(AnsiString AFileName = "");
AFileName ,
, dbxconnections.ini. , AFileName .
TSQLConnection , TDatabase, TSession BDE. ,
TSession, TSQLConnection , ( , ,
, ..). Get GetTableName,
GetProcedureParams, GetProcedureNames , GetlndexNames, GetFieldNames.
TSession (BDE).
GetTableName :
void _ fastcall GetTableNames(Classes: :TStrings* List,
bool SystemTables = false) ;
List .
. SystemTables true, List .
TableScope TSQLConnection.
-, : tsTable
( ), tsSysTable ( ), tsSynonym (), tsView ().
TSQLConnection , , : BeforeConnect, AfterConnect, BeforeDisconnect,
AfterDisconnect OnLogin. , BeforeConnect
, . , .
BeforeConnect, .
void _ fastcall TForml: : SQLConnectionlBeforeConnect (TObject *Sender)
{
if (SQLConnectionl->LoginPrompt == true)
SQLConnectionl->LoginPrompt = false;
SQLConnectionl->Params->Values ["User_Name"] =
Edi tUserName->Text ;
SQLConnectionl->Params->Values ["Password"] =
Edi t Pas sword ->Text;
4. -
237
IBExpress
Interbase,
Interbase Express. , InterBase, .
TIBDatabase. , , Database Editor (. 4.11).
Database Component Editor
rConnection '.. <
JLJ
Browse!
atafaase:
:JD:\Data\Myibdatagdb
Database Paranv
User Name'.
SYSDBA
Password:
jmasterkey
user_name=SYSDBA
password=masterkey
SflLRole:
Character Set
JNone
*)
R Login Prompt
OK
[' I Cancel
lest
iietp
. 4.11. TIBDatabase
TIBDatabase ,
Register Server and Connect IBConsole (. . 4.3). ,
. , , , .
Settings,
, , Params. Character Set
, LoginPrompt. ,
Test, . ,
(Successful Connection).
(.. Connected
true}, TIBDatabase
238
.
DatabaseName, !
, Params.
, TIBDatabase ,
Interbase. SQLDialect SQL
( SQL Interbase ). *
IdleTimer ,
, ,
TIBDatabase.
KeepConnection TDatabase (BDE) TSQLConnection (dbExpress).
IdleTimer , . true KeepConnection TDatabase
TSQLConnection. false KeepConnection
IdleTimer. , Interbase Express
.
TIBDatabase AllowStreamedConnected.
,
, . Connected
TIBDatabase true ,
.
, Connected true.
AllowStreamedConnected false,
Connected
true ( Open). ,
Interbase,
.
- TraceFlags ,
SQL Monitor,
C++ Builder. , ,
SQL. . 4.12 SQL Monitor , SQL
Explorer'e MylBData , ITEMS.
TraceFlags
TTraceFlag:
Q
Q
CD
tfQPrepare Prepare;
tfQExecute ExecSQL;
tfQFetch Fetch;
tfError ;
t/Stmt SQL;
G tfConnect ,
;
Q tjTransact StartTransaction, Commit Rollback;
Q (/Blob Blob;
4. -
239
U: i SQL Monitor
View
Clients
Options
Help
tfService ;
Q tfMisc , .
TTraceFlag - TraceFlags, SQL
Monitor. TraceFlags .
240
, :
InterBase.
TIBTransaction
DefaultDatabase TIBDatabase Active true.
,
. ,
, ,
. , Interbase ( Interbase Express)
. ,
.
, (, , , ). .
Interbase.
dbGo (ADO)
dbGo dbExpress. ,
TADOConnection,
TSQLConnection. , dbGo (, TADOConnection) Microsoft Access Microsoft SQL Server,
.
TSQLConnection
Interbase.
, ,
ODBC Interbase. ODBC, .
ODBC.
Interbase ( , , ), . ,
, ODBC Interbase EasySoft,
.
ADO Edit ConnectionString
TADOConnection. , ADO
Microsoft, , . (. 4.13) , ADO. dsn (Data Source
Name) udl (Microsoft Data Link), Use Data Link File.
Browse, . udl /Common Files/System/ole db/Data Links, dsn /Common Files/
odbc/Data Sources. , ADO .
dsn udl ( ),
Use Connection String Build.
, (. 4.14).
. Interbase ( ) Microsoft OLE DB
4. -
241
Formb>ADOConnection1 ConnectionString
Source of Connection
se Data Link File
Build..
OK
fctelp
Cancel
. 4.13. ADO
Provider for ODBC Drivers. ( ).
L*i
| |
:
OLE DB
_ ^'-_j._./^.^:,,_,_^ :^_
MediaCatalogDB OLE DB Provider
MediaCatalogMergedDB OLE DB Provider
MediaCatalogWebDB OLE DB Provider
Microsoft Jet 4.0 OLE DB Provider
Microsoft OLE DB Provider For Data Mining Services
Microsoft OLE DB Providerjpr Micrgsgfj Office Search
||||||;|'1)|^'||
Microsoft OLE DB Provider for OLAP Services 8.0
Microsoft OLE DB Provider for Oracle
Microsoft OLE DB Provider for SQL Server
Microsoft OLE DB Simple Provider
MSDataShape
. 4.14. OLE DB
242
(
DSN ODBC)
.
(. 4.15). (. . 4.16)
dsn-, ,
. ODBC (. 4.17). .
dsn- ,
.
j | |
. : :
1. :
(~
^]
:
...;
;
. ..;.'
'
'
2.
:
*
"
3. :
5
HpogepnTb
. 4.15.
4. -
243
~~~
I |
(Data Sources
'
1 ,
:
.
! , ODBC,
. 4.16.
dsn-
dsn. . ODBC EasySoft
, . 4.18. , , .
Test . ,
(. . 4.16),
dsn-. . , ( EasySoft InterBase DSN Setup),
,
. ,
, . ,
. , , , Connected TADOConnection true.
, , TADOConnection, ConnectionString. , , , , , :
244
, i
6.01.86
1.00.01 :
4.00.44
4.00.44
6.01 .
4.00.44
4.00.44
4.00.44
.01.86
<l
..
>
. 4.17. ODBC
Easysoft InterBase DSN Setup
Database:
| D .\Deta\Myl BData.gdb
User Name:
(SYSDBA
: Password;
::Role;
"
With Schema:
"
No Wait:
Dialect:
|3 jj
Execute Proc
"
Leave Quotes:
UID Override:
Read Only:
Character Set:
OK
Cancel
Help
. 4.18. ODBC
4. -
245
, ConnectionString ,
.
TADOConnection ,
. TSQLConnection, . .
dbExpress
, dbExpress,
, .
(Unidirectional Datasets)
. , . , , .
,
. (, ),
- TDataSet, ,
, .
, :
Q ,
: .
Next First, .
. , , ,
.
Q , .
Edit .
(,
SQL Update).
246
Q , ,
.
.
SQL, WHERE.
Q .
, .
U (,
TDataSource) TDBGrid ().
, ,
.
dbExpress
TSQLTable, TSQLQuery, TSQLStoredProc TSQLDataSet.
TSQLTable
TSQLTable .
, TSQLTable
TSQLConnection. TSQLConnection - , TableName
. TableScope , TableName
. , ,
Active true.
TSQLConnection TSQLTable ( ).
SQL, . , ,
SQL . , TSQLTable Category,
:
4. -
247
. ,
, - .
, ,
, .
, AutoClone false. . ActiveStatements. SQL.
MaxStmtsPerConn,
TSQLConnection ( SQL Execute).
TSQLTable
. ( ) TDataSource DataSet TSQLTable.
TDataSource , TDBGrid (). : Operation not allowed on a
unidirectional dataset ( ).
, , .
TSQLConnection, TSQLTable TDataSource,
. SQLConnectionl, MylBData.gdb
( Interbase , MyData). SQLTablel SQLConnectionl,
TableName Category .
SQLTablel DataSet DataSourcel.
SQLTablel Category. , (TPanel) .
(TDBNavigator), DataSourcel.
, . 4.19. .
SQLTable Demo
CATEGORYNO
CATEGORY
___..
. 4.19. , ,
,
(Prior Last)
248
, , , . , .. , Prior Last .
TDBEdit
. TDBEdit ,
ReadOnly true.
, , TSQLTable.
( TClientDataSet),
(TDataSetProvider).
, (. . 4.19).
TDataSetProvider
TClientDataSet, . Data Access . SQLConnectionl SQLTablel
, DataSourcel ClientDataSetl ( DataSet). ,
ProviderName ClientDataSetl DataSetProviderl,
DataSet DataSetProviderl SQLTablel.
:
4. -
249
TClientDataSet TDataSetProvider,
. .
, (. . 4.19).
. , .
- VisibleButtons,
, . , , false.
nbFirst, nbPrior, nbNext nbLast. , nbPrior
nbLast .
, nbPrior nbLast.
, .
. , nbPrior nbLast ( ). BeforeAction TDBNavigator.
:
typedef void
fastcall
TNavigateBtn Button);
Button, ,
, . , TNavigateBtn, VisibleButtons.
BeforeAction , .
, ,
. AbortQ. BeforeAction :
void
fastcall TForml::DBNavigatorlBeforeAction(TObject *Sender,
TNavigateBtn Button)
{
if((Button == nbPrior) || (Button == nbLast))
{
AbortQ;
\
}
, , .
: TDBEdit
TEdit, ECatNo (CategoryNo), ECategory (Category) EDescription
(Description). ,
TDBEdit . ReadOnly true,
.
TEdit,
TDBEdit, -
250
. .
AfterScroll , :
void _ fastcall TForml: : SQLTablelAfterSci"oU (TDataSet *DataSet)
{
if (!SQLTablel->FieldByName("CategoryNo")->IsNull)
{
ECatNo->Text=SQLTablel->
FieldByNameC "CategoryNo") ->AsSt ring;
ECategory->Text=SQLTablel->
FieldByName( "Category ")->AsStr ing;
EDescription->Text=SQLTablel->
Fi eldByName("Descript ion") ->AsSt ring;
Category,
AfterScroll CategoryNo . , CategoryNo
, . (, ()). , .
111("\!\ ") NULL.
, , .
. ,
.
.
RecNo, Paradox,
,
- 1 . , , .
NRec. private
TForml ( Unitl.h) :
long NRec;
OnCreate
NRec .
BeforeAction ,
, :
v o i d _ fastcall TForrtil : :DBNavigatorlBeforeAction(TObject *Sender,
TNavigateBtn Button)
{
swi tch(Button)
{
case nbFirst: { NRec=l ; break;}
case n b P r i o r : { NRec-=l; break;}
4. -
251
}
if ((Button == nbPrior) || (Button == nbLast))
{
try
AbortO ;
}
_ finally
{
MoveToRecQ ;
,
. NRec .
, NRec
( RecordCount). ,
nbPrior nbLast, , ( Abort), (
MoveToRec).
Abort (EAbori).
, .
_ finally,
. ,
try... _ finally, , Abort,
. BeforeAction
Abort MoveToRec, _ finally.
MoveToRec private TForml.
, NRec.
() MoveToRec:
void _ fastcall TForml: :MoveToRec(void)
{
Process=true;
SQLTablel->First();
for(long i=l; KNRec; i++) SQLTablel->Next() ;
if (NRec == SQLTablel->RecordCount) SQLTablel->Next() ;
Process=false;
}
First Next. MoveToRec
, NRec / Next. Last, Next .
Next . (
AfterScroll
252
SQLTable Demo
<
Ins
Del
Edit
Post
Cancel
\ CATEGORYNQ
CATEGORY
DESCRIPTION
:
. 4.20. ,
,
BEdit, Bins BDel , . , , .
Unitl.h TForml :
void
{
4. -
253
KindOfState=kosEdit;
}
, OnClick BEdit
.
ECategory EDescription ( ,
ReadOnly ECatNo ). ECategory ( SetFocus).
KindOfState kosEdit. ,
ECategory EDescription.
(kosEdii), : , , , .
BPost BCancel.
:
void
{
}
, . .
, Posting,
Canceling. private TForml.
Posting:
254
case koslnsert:
SQLText="INSERT INTO Category
(Category, Description) VALUES ('" +
ECategory->Text + "', '" + EDescription->Text
NRec=SQLTablel->RecordCount+l ;
break;
case kosDelete:
SQLText="Delete From Category Where CategoryNo="
ECatNo->Text + ";";
NRec-=l;
SQLConnectionl->Execute(SQLText, NULL, NULL)
ECategory->ReadOnly=true;
EDescription->ReadOnly=true;
if (KindOfState == koslnsert) MoveToRecQ;
if (KindOfState == kosDelete)
{
if (NRec > 1) MoveToRecO;
if(NRec == 0)
ECatNo->Clear() ;
ECategory->Clear() ;
EDescription->Clear() ;
KindOf State=kosBrowse;
}
Posting
SQL. ,
koslnsert, NRec 1 ,
, NRec 1 . , SQL ( , ). ,
Execute TSQLConnection.
:
4. -
255
( ) ).
(kosBrowse).
Canceling ,
(kosEdit, koslnsert kosDelete).
, ,
,
(Read Only). (
KindOfState kosBrowse).
, . , ,
. ,
BeforeScroll , . , Process.
true, ,
MoveToRec.
BeforeScroll . , . Posting,
Canceling. .
- 4.1 4.2.
.
, , .
4.1. SQLTableDemoZ
#ifndef UnitlH
#define UnitlH
#include <Classes.hpp>
^include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
^include <DB.hpp>
#include <DBCtrls.hpp>
#include <DBXpress.hpp>
#include <ExtCtrls.hpp>
#include <FMTBcd.hpp>
#include <Mask.hpp>
#include <SqlExpr.hpp>
enum TKindOfState { kosBrowse, kosEdit, koslnsert, kosDelete };
class TForml : public TForm
published:
// IDE-managed Components
TSQLTable *SQLTablel;
TSQLConnection *5QLConnectionl;
TDataSource *DataSourcel;
256
TIntegerField *SQLTablelCATEGORYNO;
TStringField *SQLTabTelCATEGORY;
TStringField *SQLTablelDESCRIPTION;
TLabel *Labell;
TLabel *Label2;
TLabel *Label3;
TPanel *Panell;
TDBNavigator *DBNavigatorl ;
TButton *BEdit;
TPanel *Panel2;
TPanel *Panel3;
TButton *BIns;
TButton *BDel;
TButton *BPost;
TButton *BCancel;
TEdit *ECatNo;
TEdit *ECategory;
TEdit *EDescription;'
void _ fastcall SQLTablelAf terScroll(TDataSet *DataSet) ;
void _ fastcall DBNavigatorlBeforeAction(TObject *Sender,
TNavigateBtn Button);
void _ fastcall FormCreate(TObject *Sender)
void _fastcall BEdi tClick(TObject *Sender)
void _ fastcall BPostClick(TObject *Sender)
void _ fastcall SQLTablelBeforeScroll(TDataSet *DataSet) ;
void _ fastcall BInsClick(TObject *Sender);
void _fastcall BDelClick(TObject *Sender);
void _ fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:
// User declarations
long NRec;
TKindOfState KindOfState;
AnsiString SQLText;
bool Process;
void _ fastcall Posting(void) ;
void _ fastcall Canceling(void) ;
void _ fastcall MoveToRec(void) ;
public:
// User declarations
_ fastcall TForml(TComponent* Owner);
extern PACKAGE TForml *Forml;
// ----- ..... - .............. #endif
4.2. SQLTableDemo2
^include <vcl.h>
#pragma hdrstop
#include "Unitl.h"
#pragma package(smart_ini t)
#pragma resource "*.dfm"
4. -
TForml *Forml;
_fastcall TForml: :TForml(TComponent* Owner)
: TForm(Owner)
void
try
AbortO;
finally
MoveToRecO ;
9 .319
257
258
case koslnsert:
{
SQLText="INSERT INTO Category
(Category, Description) VALUES ('" +
ECategory->Text + "', '" + EDescription->Text +
"'):";
NRec=SQLTablel->0RecordCount+l;
break;
}
case kosDelete:
{
SQLText="Delete From Category Where CategoryNo=" +
ECatNo->Text + ";";
NRec-=l;
ECatNo->Clear() ;
ECategory->Clear() ;
EDescription->Clear() ;
KindOf State=kosBrowse;
4. -
fastcall TForml::Canceling(void)
if((KindOfState != kosEdit) && (KindOfState != koslnsert))
return;
ECatNo->Text=SQLTablel->FieldByName("CategoryNo")->AsString;
ECategory->Text=SQLTablel->FieldByName("Category")->AsString;
EDescription->Text=SQLTablel->FieldByName("Description")->
AsString;
Ki ndOfState=kosBrowse;
ECategory->ReadOnly=true;
EDescription->ReadOnly=true;
259
260
ECategory->SetFocus() ;
void _ fastcall TForml: :MoveToRec(void)
{
Process=true;
SQLTablel->First();
for(long i=l; KNRec;
i++) SQLTablel->Next() ;
4.1 4.2 ,
.
. , .
.
4. -
261
, TSQLTable .
, ,
. TSQLQuery.
TSQLQuery SQL . SQL SQL. , , true Active.
(INSERT, UPDATE, DELETE) (
(DDL)) ExecSQL. , TQuery BDE,
TSQLQuery. , ,
TSQLQuery, .
dbExpress . DBConnection TSQLStoredProc
-, StoredProcName
.
, ,
Active true. .
, (.. ), .
(input) (output) Params. StoredProcName
, Params .
,
Params. - , .
, , .
Q . ParamType: ptlnput
( ), ptOutput ( ), ptinputOutput ( , ), ptResult ( , ;
), ptUnknown ( ; -
).
Q DataType. ,
, DriverName TSQLConnection.
TSQLStoredProc ,
DataType , . , , .
Size, Precision NumericScale. ,
(
).
Q Value. .
, ,
. ,
262
Value ,
:
StoredProcl->DBConnection="SQLConnectionl";
StoredProcl->StoredProcName="ADD_EMPLOYEE";
StoredProcl->Params->Clear()
;
StoredProcl->Params->ParamByName("LName")->AsString="HeKTO";
,
( ).
, Execute TSQLStoredProc. ,
, true Active TSQLStoredProc,
Open.
, , .
,
.
Value .
TDataSet, dbExpress, TSQLDataSet. ,
. , , .
TSQLDataSet CommandType CommandText. , , SQLConnection TSQLConnection.
-'
EMPLOYEE
INVOICES
ITEMS
MONLIST
STORAGE
CATEGORY
CATEGORYNO
DESCRIPTION
. 4.21. , CommandText
TSQLDataSet
4. -
263
CommandType ,
TSQLDataSet. , ,
: ctQuery, ctTable ctStoredProc.
ctTable, CommandText
(, , , TableScope TSQLConnection).
CommandType ctStoredProc,
CommandText . , , ctQuery, CommandText
. CommandText (. . 4.21). , ,
, , SQL
, SQL .
TSQLQuery
TDataSet
dbExpress. TSQLDataSet ,
, Active true (
Open). - ExecSQL.
TSQLCIientDataSet
TSQLClientDataset TDataSet
dbExpress, , . ,
,
. , .
. ,
, MyBase, . xml cds; xml cds.
MyBase ,
(), . TSQLCIientDataSet , .
, , xml cds. , ,
, TSQLConnection .
TSQLCIientDataSet
FileName . ,
.
Load from MyBase table TSQLCIientDataSet.
TSQLCIientDataSet TDataSource, , ,
, (TDBGrid). .
264
, LoadFromFile, :
void
, . ,
, ,
FileName. LoadFromFile. ,
d:\Data\Category.cds:
SQLClientOataSetl->LoadFromFile("D:\\Data\\Categ.cds");
SQLClientData5etl->Open():
LoadFromFile TCustomCachedDataSet, TSQLClientDataSet. SaveToFile,
, ,
TCustomClientDataSet, , TCustomCachedDataSet. :
void
fastcall SaveToFile(const AnsiString FileName = "",
. TDataPacketFormat Format = dfBinary);
FileName AnsiString ,
TSQLClientDataSet.
Format TDataPacketFormat ,
. : dfBinary ( cds), dJXML (xml -),
dfXMLUTFS (/- UTF8).
MyBase ,
(- ). ,
MyBase , (briefcase model).
. . ,
(, ),
. , ,
, , .
, .
,
. TDBGrid, TDataSource, TSQLClientDataSet TSQLConnection, , . SQLConnectionl
MylBData. DBGridl DataSourcel,
, , SQLClientDataSetl.
(TButton), (
Caption): BGetData , BOnOffu , BSaveData . , . 4.22.
4. -
265
I I
ITEMNITEM
[Samsung ML-4500
2i Samsung ML-1210
'^
ICATEGJCJESCRIPTION
11 AACaDI, 2, 600jdpi.jil
11A4, GDI ' . 600 dpi
|
|
|
_^
^.^!!??0^!!,
. 4.22. ,
BGetData ( ) , CommandText
SQLClientDataSetl , .
BGetData:
repl=Application->MessageBox(
" . ?",
"!",
MB_YESNO + MB_ICONQUESTION);
if(repl == IDNO) return;
SQLClientDataSetl->Active=false;
SQLClientDataSetl->FileName="";
SQLClientDataSetl->DBConnection=SQLConnectionl;
SQLClientDataSetl->CommandType=ctTable;
SQLClientDataSetl->CommandText="ITEMS";
SQLClientDataSetl->Active=true;
SQLClientDataSetl->SaveToFile(DataFileName, dfBinary);
SQLClientDataSetl->Active=false;
BOnOff->Caption = "";
,
266
DataFileName, :
Ansi String DataFileName="d: \ \ D a t a \ \ B r i e f . c d s " ;
, .
BGetData
. ,
. ,
. ,
. , SQLClientDataSet. , . :
Filename, SQLClientDataSet 1,
(ctTable) ITEMS. :
, , ,
.
SaveToFile, ,
. .
BGetData BOnOffaoy . cds, Items.
BOnOff
Items.
:
SQLClientDataSetl->Act1ve=false;
BOnOff->Caption = "";
.
, .
DBConnection ( , ), FileName
. .
.
BSaveData -
4. -
267
(),
.
, .
LogChanges true ( ),
TSQLClientDataSet , (, ,
). TSQLCLientDataSet Data.
Data , . ,
, ; Delta, OleVariant.
ChangeCount.
, ,
ApplyUpdates. (
FileName DBConnection TSQLConnection),
ApplyUpdates, :
virtual int
ApplyUpdates MaxErrors
, . MaxErrors -1;
.
ApplyUpdates .
Q Before ApplyUpdates.
Q TSQLClientDataSet,
Delta . ,
.
Q After ApplyUpdates.
Q Reconcile. , ,
OnReconcileError. , Delta ,
. MergeChangeLog
Data,
ChangeCount.
ApplyUpdates ,
.
LogChanges false,
Data.
, . .
.
BSaveData:
void
{
268
if(FileExists(DataFileName))
{
repl=Application->MessageBox(
" ?",
"!",
MB_YE5NOCANCEL + MB^ICONQUESTION);
}
if(repl == IDCANCEL) return;
SQLClientDataSetl->Active=false;
BOnOff->Caption = "";
SQLClientDataSetl->DBConnection=SQLConnectionl;
SQLClientDataSetl->CommandType=ctTable;
SQLClientDataSetl->CommandText="ITEMS";
SQLClientDataSetl->Active=true;
if(repl == IDYES)
SQLClientDataSetl->ApplyUpdates(-l);
else
SQLClientDataSetl->CancelUpdates();
SQLClientDataSetl->Active=false;
}
( ChangeCouni). , .
Cancel, .
SQLConnection,
Items. ,
ApplyUpdates, CancelUpdates,
.
.
TSQLClientDataSet . , . ApplyUpdates
,
. ,
TSQLClientDataSet ,
. , ,
, .
, OnGetTableName BeforeUpdateRecord. OnGetTableName TCustomCachedDataSet :
typedef void
fastcall ( closure *TGetTableName)(TObject* Sender,
Db::TDataSet* DataSet, AnsiString &TableName);
, , . TableName. -
4. -
269
. Sender
, DataSet
.
BeforeUpdateRecord. , Delta (..
).
TCustomCachedDataSet;
typedef void
fastcall ( closure *TBeforeUpdateRecordEvent)
(TObject* Sender, TDataSet SourceDS, TCustomClientDataSet *DeltaDS,
Db::TUpdateKind UpdateKind, bool &Applied);
, OnGetTableName,
. DeltaDS
, . UpdateKind , : ukModify ( ), uklnsert ( ),
ukDelete ( ). ,
, Applied. Applied true, . Applied false.
, . ,
, Applied
true, , , false (
, ).
BeforeUpdateRecord:
void
{
fastcallTForml::SQLC1ientDataSetlBeforeUpdateRecord(TObject
*5ender, TDataSet *SourceDS, TCustomClientDataSet *DeltaDS,
TUpdateKind UpdateKind, bool &Applied)
AnsiString SQLString;
SQLConnection *Connectionl=
(dynamic_cast<TCustomSQLDataSet *>(SourceDS)->5QLConnection);
switch (UpdateKind)
case ukModify:
SQLString="Update ! " +
"Set 1=" + FormatFunc(DeltaDS->Fields->
Fields[l]->NewValue) + ","
"rioneN=" + FormatFunc(DeltaDS->Fields->
Fields[N]->NewValue) +
"Where 1=" +
FormatFunc(DeltaDS->Fields->Fields[0]->OldValue)
Connectionl->Execute(SQLString, NULL, NULL);
(
)
break;
270
case uklnsert:
SQLString="Insert Into !(!. ... ) " +
"Values (" + FormatFunc(DeltaDS->Fields->
Fields[l]->NewValue) + ","
FormatFunc(DeUaDS->Fields->Fields[N]->NewValue) +
) - +
"Where 1=" +
FormatFunc(DeltaDS->F1elds->Fields[e]->OldValue)
Connectionl->Execute(SQLString, NULL, NULL);
(
)
break;
}
BeforeUpdateRecord FormatFunc
AnsiString (, IntToStr).
TSQLClientDataSet ,
.
,
(,
/). ,
TSQLClientDataSet,
dbExpress.
TSQLMonitor
dbExpress, ,
TSQLMonitor. , C++ Builder, TSQLMonitor .
, ,
TSQLConnection. TSQLMonitor TSQLConnection SQL,
.
TraceList,
. StringList .
TSQLMonitor . BriefcaseDemo,
, .
, -
4. -
271
. TSQLMonitor
SQLConnection SQLConnection. (He ,
dbExpress DBConnection.) ,
FileName.
,
FileName. SQL,
TSQLMonitor. ,
AutoSave true. true
Active, TSQLMonitor .
.
- , SQLConnection 1. , ,
, . .
, SQL, SQLConnection 1
(. . 4.23).
INTERBASE - isc_attach_database
INTERBASE - isc_dsql_allocate_statement
INTERBASE - isc_start_traneaction
select * from "ITEMSINTERBASE - isc_dsql_prepare
INTERBASE - isc_dsql_describe_bind
INTERBASE - isc_dsql_execute
INTERBASE - isc dsql allocate.statement
SELECT 0, ", ", A.RDB$RELATION_NAME, A.RDB$INDEX_NAME,
INTERBASE - isc_dsql_prepare
INTERBASE - isc_dsql_describe_bind
INTERBASE - isc_dsql_execute
INTERBASE - isc.dsql.fetch
INTERBASE - isc_dsql_fetch
INTERBASE - isc_dsql_fetch
INTERBASE - isc_dsql_fetch
. 4.23. TSQLMonitor
SQL
TSQLMonitor.
OnLogTrace.
:
typedef void
fastcall ( closure *TTraceLogEvent)
(System::TObject* Sender, pSQLTRACEDesc CBInfo);
272
struct SQLTRACEDesc {
char pszTrace[1024];
TRACECat eTraceCat;
int ClientData;
WORD uTotalMsgLen;
}
pszTrace , uTotalMsgLen . ClientData (callback), .
eTraceCat TSQLTraceFlag, (). :
Q traceQPREPARE .
traceQEXECUTE .
Q traceERROR . .
Q traceSTMT ALLOCATE, PREPARE,
EXECUTE FETCH.
Q traceCONNECT / , .
G traceTRANSACT , (BEGIN, COMMIT
ROLLBACK).
Q traceBLOB Binary Large Object, STORE BLOB,
GET BLOB ..
traceMISC (),
.
Q traceVENDOR API (, isc_attach_database
isc_ Interbase).
Q traceDATAIN , , , Update
Insert.
CD traceDATAOUT .
, CBInfo,
. , OnLogTrace , TraceList ,
. OnLogTrace,
TraceList ,
:
void
4. -
{
*
273
TSQLMonitor.
,
TraceList. :
typedef void
fastcall ( closure *TTraceEvent)
(System::TObject* Sender, pSQLTRACEDesc CBInfo, bool &LogTrace);
,
OnLogTrace, LogTrace . true, ..
TraceList. TraceList,
LogTrace false.
TSQLMonitor , . TraceCount, , , TraceList. TraceList
( Clear) TraceCount 0. MaxTraceCount
,
TraceList.
, , , TSQLMonitor. ,
. , , . , ,
.
,
.
, - .
Interbase. , Interbase,
IBConsole ISQL. , , , , , ,
Interbase.
Interbase. ,
, Interbase,
Interbase (, , ),
.
. Interbase
dbExpress, IBExpress ADO. -
274
, dbExpress. BHJ
, !
TSQLTable, TSQLQuery, TSQLStoredProc TSQLDataSet.
, !
.
TSQLClientDataSet TSQLMonitor.
MyBase ( )
, TSQLMonitor ,
- TSQLConnection .
''".
" '
Quick Report
TQuickRep
TQRLabel, TQRDBText, TQRExpr TQRSysData
Quick Report
Decision Cube
. (.. ) (, ..). ( )
QuickReport, ,
Decision Cube.
. QuickReport.
QuickReport
Quick Report , QuSoft AS
(www.qusoft.com) QBS Software (www.qbss.com).
C++ Builder 3.0.9, Web- 5.0 Professional.
QReport 23 .
. .
.
276
, ,
, .
, .
, Other File \ New. New Items nepei
Business Quick Report Wizard,
(. 5.1).
. 5.1.
, , .
, Select
Report. , C++ Builder,
, List Report ( ).
, Start Wizard.
( .5.2).
.
. ( A lias or directory),
Table name. Available fields.
(>, , < ), ,
.
Selected fields. , Finish. . , (. 5.3).
5.
277
rSelect atable
*[
Browse
ltems.DB
Select Fields-:"
Bailable fields
ItemNo
Item
Category
Description
Index
Price
Fmish
Cancel
. 5.2.
StemNIo
" ]tem
Page Foote:
'
. 5.3. -
, - , . , ,
278
, |
, . ,
TQuickRep, .
. : <
BDE. ,
BDE.
Forml
- Form2. <
, . Form2
Forml. Forml File Include Unit He
Unit2 .
Forml ( TButton).
:
Form2->QuickRepl->Preview();
Forml, . , :
Print Preview, (. 5.4).
Print Preview
iNo
Item
Category
Description
1 Samsung ML-4500
2 Samsung ML-1210
3 Epson EPL-5900L
4 Canon LBP-810
5.
279
. Print Setup
. ,
Print. , qrp (
Quick Report). , Save Report.
t/r/7- Print Preview Load Report.
Form2, , . ,
BDE. BDE , ,
SQL. , , ,
Interbase, (IBLocal).
, .
, ( , Quick Report).
BDE, , SQL. SQL ,
, .
,
.
, , . , .
.
( Form File \ New) TQuickRep.
TQuickRep, , . , 4 ( 1123 794 ). ,
TQuickRep .
.
dbExpress ( ). ,
TQuickRep, TSQLConnection TSQLDataSet,
.
. , MylBData, SQLDataSetl. CommandText :
SELECT SALES.SALEDATE, SALES.CHECKN, EMPLOYEE.LNAME,
ITEMS.ITEM, SALEPARTS.QTY
FROM SALES
INNER JOIN SALEPARTS
ON (SALEPARTS.SALE = SALES.SALENO)
INNER JOIN EMPLOYEE
ON (EMPLOYEE.EMPLOYEENO = S A L E S . E M P L O Y E E )
INNER JOIN ITEMS
ON (ITEMS.ITEMNO = SALEPARTS.ITEM)
WHERE SALES.SALEDATE BETWEEN ' 6 / 1 / 0 2 ' AND ' 6 / 3 0 / 0 2 '
280
, SQL, :
. ,
CheckN Sales, LName Employee, Item Items i
SaleParts. , <
SaleDate Sales 01.06.02 30.06.02.
, 2002 .
Sales SaleParts, ;
SQL, 5.1.
5.1. ,
SALES SALEPARTS
CREATE GENERATOR SALE_GEN;
CREATE TABLE SALES
(
SALENO
PKEYFIELD,
SALEDATE
TIMESTAMP NOT NULL,
CHECKN
VARCHAR(IO) NOT NULL,
EMPLOYEE
FKEYFIELD,
COMMENT
VARCHAR(SO).
PRIMARY KEY (SALENO),
UNIQUE (CHECKN)
);
SET TERM ;
5.
281
SET TERM
SET TERM ;A
, Active SQLDataSetl
true. .
DataSet TQuickRep SQLDataSetl (
, ).
, , TDataSource.
.
, TQuickRep.
(DetailBand). ,
, . , ,
: (ColumnHeaderBand)
(TitleBand).
,
. , ,
, .
TQRBand.
Bands TQuickRep. Bands 6 , Has. -
true, . true
HasDetail, HasColumnHeader HasTitle.
.
TQRDBText ( QReport), . TQRDBText TDBEdit Data Controls. AutoSize
TQRDBText true.
, ,
. ,
TQRDBText SQLDataSetl ( DataSet).
, DataField TQRDBText
, . ,
, ( ) TQRDBText
: CheckN, SaleDate, LName, Item, Qty.
282
ColumnHeaderBand. :
TQRLabel, !!!
, DetailBand. :
( Caption): CheckNo, SaleDate, Employee, Item Quan
tity. , Frame
true DrawBottom DrawTop. ]
TitleBand TQDLabel. Caption *
. 2002 . . , Font TQRLabel. ,
12 fsBold.
, ,
Preview TQuickRep. :
Form2->QuickRepl->Preview() ;
. 5.5, . 5.6.
pjfp^r~
|*
t"heckNo!TfealeDate
Employee
bhlECKN ^ALEDATEtNAME
. J*5>ft
_ _ _ . _
,__::
Htem
ITEM
.__-*=--
- _; *
. 5.5. ,
TQuickRep, .
TQuickRep
, TQuickRep,
. .
TQuickRep DataSet Bands. DataSet
(BDE, dbExpress ..).
Bands ,
TQRBand. Bands, ,
Has. ,
( , .. TQRBand,
).
5.
283
~l'. 2002 .
||
*
'
<
>
| \ ~ gosej
2002 .
1
1
CheckNo SaleDate
Employee
Chk-166
Chk-166
Chk-166
Chk-166
Chk-167
Chk-168
01.06.02
01.06.02
01.06.02
01.06.02
02.06.02
02.06.02
Chk-168
Chk-168
02.06.02
02.06.02
_J
Epson Stylus Photo 810
Socket 423 (Pentium 4) Intel DSSOGBG^;;
Epson Stylus Color C80
Canon CanoScan N656U
Intel Pentium 4 1.6 GHz
HP DeskJet 980C
Socket 478 (Pentium 4) Abit 7H7II
jH
Canon CanoScan D646U
Chk-168
Chk-169
02.06.02
02,06.02
DIMM128MbPC133. NCP
17"(16") Samsung 753DFX
Item
ll^.,..
" V V . . . :';;.,,;.
\^*&*~
. 5.6.
Q PageHeaderBand ( HasColumnHeader).
,
. , FirstPageHeader Option TQuickRep. true, ..
.
TitleBand ( HasTitle). TitleBand (,
) ,
, . TitleBand
.
Q ColumnHeaderBand ( HasColumnHeader). , , ,
( ), (. ). TQRLabel,
.
Q DetailBand ( HasDetail). ,
, , DataSet TQuickRep. TQRDBText,
, DataSet. , .
284
;
( ).
U SummaryBand ( HasSummary).
, .
.
PageFooter ( HasPageFooter). :
. LastPageFooter ;
Options TQuickRep false, !
.
,
, . ,
TQuickRep. , )
. dbExpress. Hz
TSQLConnection TSQLDataSet. , , MylBData
SQLDataSetl SQLConnectionl,
CommandText :
SELECT SALES.SALEDATE, SALES.CHECKN, ITEMS.ITEM,
SALEPARTS.QTY, ITEMS.PRICE
FROM ITEMS
INNER JOIN SALEPARTS
ON (SALEPARTS.ITEM = ITEMS.ITEMNO)
INNER JOIN SALES
ON (SALEPARTS.SALE = SALES.SALENO)
WHERE SALES.SALEDATE BETWEEN ' 0 1 . 0 6 . 0 2 ' AND ' 3 0 . 0 6 . 0 2 ' ;
SQL ,
. ,
SaleDate, CheckN, Item, Qty Price.
, 2002 . ,
Active true.
Bands true.
.
. PageHeaderBand
TQRSysData. , .
TQRSysData Data. ,
Data, , ,
TQRSysData. :
qrsDate .
U qrsTime .
Q qrsDateTime .
Q qrsReportTitle , ReportTitie
TQuickRep. Print Preview.
U qrtPageNumber .
.
5.
285
Q qrtDetailNo ,
. .
Q qrsDetailCount , .
. TQRSysData,
, , Data qrsDate. Data TQRSysData,
, qrsReportTitle. ReportTitle TQuickRep -
, , 2002 ..
. , Frame
PageHeaderBand DrawBottom true. .
,
false FirstPageHeader Options TQuickRep.
. PageFooterBand
TQRSysData. Data qrtPageNumber.
, true
DrawTop Frame PageFooterBand.
(TitleBand) TQRLabel Caption , ReportTitle TQuickRep.
.
,
. DetailBand
TQRSysData, TQRDBText
TQRExpr. . ColumnHeaderBand
TQRLabel, ( Caption) ( ): , SaleDate, CheckNo, Item, Quantity, Price Cost.
,
TQRLabel fsBold ufsltalic.
Data TQRSysData, ,
qrtDetailNo. .
( TQRDBText)
SQLDataSetl ( DataSet). ( DataField) ( )
: SALEDATE, CHECKN, ITEM, QTY, PRICE.
, ,
TQRExpr. , , , .
TQRDBText, TQRExpr DataSet.
Expression , .
.
Expression ,
(Expression Wizard).
286
Enter expression;
SQLDataSetl .QTY" SQLDataSetl PRICE
- j 5
. 5.7.
Available fields
SALEDATE
CHECKN
ITEM
QTY
PRICE
. 5.8. ,
.
MEMO,
(. 5.7).
,
. Database field
, -
5.
287
. ,
(. 5.8). ,
, .
, , ,
, ,
, .
Lxpression Wizard
-Select functionCategory
STR
UPPER
LOWER
PRETTY
TIME
DATE
COPY
5.9.
Function
(. 5.9).
, Continue.
(. . 5.7). ().
, , Variable
.
(. . 5.10): PAGENUMBER (
), COLUMNNUMBER ( ), REPORTTITLE ( ),
APPSTARTTIME ( ), APPSTARTDATE ( ) APPNAME ( ).
,
. Modify variables.
TQRExpr ,
,
. Expression :
SQLDataSetl.QTY * SQLDataSetl.PRICE
.
(SummaryBand). ,
, .
288
COLUMNNUMBER
REPORTTITLE
APPSTARTTIME
APPSTARTDATE
APPNAME
. 5.10.
TQRExpr TQRLabel, . !
, Font TQRExpr fsBold ufsltalic,
Font TQRLabel fsBold HfsUnderline. Caption
TQRLabel .:, Expression TQRExpr :
SUM(SQLDataSetl.QTY * SQLDataSetl.PRICE)
. , Preview TQuickRep. .
5.11 ( ) 5.12 ( ).
5.
289
JReport title);
'Page Header
2002 .
"SaleDate
"CheckNo
Item
"Quantity
T
Price
QTY
Cosi
T>RICE
"^QLDataSef
": SUM(SQLDataSet1.QTY'
'
'
Page F,it>!(
. 5.11. , TQuickRep
? 2002 .
@*[
Close)
* 2002 .
ChecWo
24.04.03
Mm
Quantity
Price
Cos*
45
34.06.02
Chk-177
>| !WinbondS200F
68
38
46
34.08.02
Chk-177
71
71
47
34.08.02
Chk-177
2156
4312
48
34.06.02
Chk-177
759
i5ie
49
34.08.02
Chk-17B
204
204
50
34.08.02
Chk-178
46
46
61
34.08.02
Chk-178
64
182
52
34.08.02
Chk-178
85
195
63
34.06.02
Chk-178
VIA MHz
42
54
55
34.06.02
35.06.02
Chk-179
24
Chk-180
KB6869 /
Fast EthernetC omplex
14
42
56
35.06.02
Chk-181
Epson SVIusPhoto810
122
368
57
35.08.02
Chk-181
168
504
53
35.06.02
Chk-182
18
59
35.06.02
813
1839
JO.UO.U^
OU
Chk-182
Chk-182
42 '
84
185%|Pagefof'
^^^^^^
5.12. , TQuickRep
10 *. 319
pi
'
290
(Printer Setup).
, (
, , ..).
PrinterSettings Page. ,
. PrinterSettings TQuickRepPrinterSettings.
TQRPrinterSettings, TQuickRepPrinterSettings : Copies ( ), Duplex (
, ), Firs/Page LastPage (
), OutputBin ( ).
Page . 11 ,
(Page Setup). :
Q TopMargin, LeftMargin, BottomMargin, RightMargin , ,
;
U Column ColumnSpace ;
Q PaperSize ; : 4, A3, 5, 4, Custom ..;
Q Length () ;
, PaperSize Custom;
Q Width ;
Q Orientation : (poLandscape) (poPortrait);
Q Ruler true, ()
.
Options, . , FirstPageHeader LastPageFooter. Compression. true,
.
Printer TQRPrinter, , ,
. TQuickRep PrintlfEmpty.
true, (, ..), .
TQuickRep , . , ,
. . TQuickRep.
TQuickRep . OnPreview
Preview. , , :
Print Preview . , ,
Preview . OnPreview
. OnPreview QuSoft www.qusoft.com.
5.
291
AfterPreview, TNotifyEvent. - , .
Print : BeforePrint AfterPrint. , BeforePrint
Preview. Print, Preview, PreviewModal PreviewModeless .
:
void
, Bands TQuickRep ,
, , . , TQuickRep TQRBand.
TQRBand BandType TQRBandType.
, ,
Bands. ,
, BandType TQRBand, : rbPageHeader ( ), rbTitle ( ), rbColumnHeader ( ), rbDetail ( ), rbSummary ( )
rbPageFooter ( ).
, BandType TQRBand, :
Q rbSubDetail
TQRSubDetail. .
292
5.
293
Expression Wizard (. .
5.7). ' .
- . SaleDate.
, Expression, : TQRGroup , . TQRGroup SaleDate, SQL Query 1,
( ).
Expression , ( ,
).
TQRGroup ,
() . , .
TQRDBText,
SaleDate. ,
. ,
fsBold wfsltalic. ,
.
, (Group
Footer). TQRBand, ,
BandType rbGroupFooter.
.
. TQRGroup ,
FooterBand, .
Group Footer , .
. .
,
Summary . ,
TQRDBText
, , , Reset After Print TQRDBText true.
, ..
.
. ,
, . . 5.13.
. , SaleDate ,
.
TQRGroup TQRBand, BandType rbGroupFooter. Expression TQRGroup
CheckN. -
294
' . 2002 .
A.
29.04.03
2002 .
* 2002 .
SafeOate
Quantity
Price
CftecMVo
Hern
122.0O$
132 .00$
396
87.00
261
185.00
740
CO*
01.0U02
1
oi.oe.02
*-1
01.06.02
01.06.02
(-1
ci*-iee
01.06.rJ2
Chk-166
1763
02.002
5
02.00.02
Ct*.172
ISPOS") Samsung855DF
298.00
2.06.2
CN<-174
CMedia Thundering
12.00
43
02.06.02
Cr*-iee
Sooket478(Pentium4)ChaintechCT-9BIA 2
107.00
214
02.06.02
Cr*-170
432
02.06.02
Cr*-172
2
1
201.00
148.00$
148
10
02.06.02
Chk.168
34.00
13
11
02.06.02
CHi-171
4
1
Page i of 1 ?
58.00
894
-;:';*; |S ' J
_u
. 5.13.
, . , , (..
), .
.
FooterBand . ,
, . Summary
. , ResetAfterPrint
true. ,
. . 5.14.
TQRBandvi TQRGroup, QReport
, .
TQRSubDetail Master/Detail.
(, TQuery TSQLDataSef).
TQRChildBand ,
ParentBand .
, , . -
5.
295
' 2002
<
2002 .
2002 .
SafeDsfe
/fern
Quantity
Prro?
Cos*
01.06.02
Chk-166
1
01.06.02
Chk-166
CanonCmoSoanNeseu
87.00*
261
2
3
4
01.06.02
01.06.02
01.06.02
<-1
CN<-1
-1
185.00*
132.CO*
122.00*
740
396
336
1763
1763
02.06.02
Chk-167
6
02.06.02
Chk-187
lntelPenlium41.6 GHz
173.00$
173
. 5.14.
, true HasChild ,
.
, , LinkBand.
TQRStringsBand ,
Items, TStrings*.
, , .
TQRStringsBand . Expression TQuickRep ,
, . .
: BeforePrint AfterPrint. .
PrintBand .
BeforePrint false, .
AfterPrint , BeforePrint. BandPrinted
, .
.
BeforePrint,
:
296
PrintBand=
((Queryl->FieldByName(SALEDATE)->
Quick Report
TQuickRep, (TQRBand, TQRGoup, TQRSubDetail, TQRStringsBand,
TQRChildBand), TQRLabel, TQRDBText, TQRExpr,
TQRSysData. QReport .
.
, Quick Report.
TQRMemo, TQRExpr Memo, TQRRichText TQRDBRichText
. Quick Report .
Lines. TQRExprMemo Lines Quick Report.
Quick Report .
,
( TQuickRep).
, :
Supplier:
City:
Address:
Contact:
{Supplier}
{City}
{Address}
{Contact}
5.
297
, . - Reports,
(TQuiickRep). .
Add.
Print,
Preview. , QRCompositeReportl,
QuickRepl ( Form!) QuickRepl ( Form2),
.
QRComposi teReportl->Reports->Add(Forml->QuickRepl);
QRCompositeReportl->Reports->Add(Form2->QuickRep2);
QRCompositeReportl->Preview();
, ( , Borland C++ Builder, ), TQRPreview.
,
.
QuSoft www.qusoft.com. TQRChart, . TQRChart
(TDBChart DataControls
TChart Additional ).
QReport QRTextFilter, QRCSVFilter
QRHTMLFilter. (ASCII), * csv ( ) HTML. , (Print Preview)
: Text file (*. TXT) (
QRTextFilter), Comma Separated (*.CSV) ( QRCSVFilter) HTML
Document (*.HTM). , .
Create,
ExportToFilter.
Decision Cube
, Decision Cube , .
Microsoft Excel,
Microsoft Office Web Component. ,
Decision Cube.
Decision Cube : TDecisionCube, TDecisionQuery,
TDecisionSource, TDecisionPivot, TDecisionGrid TDecisionGraph. TDecisionQuery
, SQL. SQL,
DatabaseName. TDecisionQuery , Active true. TDecisionQuery ( ,
) TQuery
BDE.
298
TDecisionQueiy , , (
Decision Query Editor). Dimensions/Summaries SQL Query (. 5.15).
Dimensions/Summari
List of Available Field
Sales.SaleNo
Sales.SaleDate
Sales.CheckN
Sales.Employee
Sales.Comment
Saleparts.SalePartNo
Saleparts.Sale
Seleparts.ltem
Saleparts.Qty
Items.ItemNo
Items.ltem
Items.Category
Items. Item
Summaries:
SUM( Items.Price *Saleparts|
SQL Builder.
Cancel
299
5.
: 2002a;p
I^^^SSSi
.2002
Fujitsu f
3.8") LG St
113.00$
3.8")LGSt
928.00$
.aer,2002
792.00$
396.00$
113.00$
1,017.00$
1,482.00$
6,422.00$
580.00$
wnsung15
unsung 15
,2002
2.048.00$
2,560.00$
487.00$
1,948.00$
imsung 55
1,120.00$
980.00$
700.00$
unsung 55
615.00$
984.00$
492.00$
imtron 5SE
714.00$
714.00$
238.00$
inySDM-N
4,805.00$
imsung 1 5
961.00$
3") Sarnsti
S"VC;m<!i,
1 nnt
988.00$
1,024.00$ J
420.00$
961.00$
2,079.00$
756.00$
|fj
'"""^:
. 5.16.
Decision Cube :
T D e c i s i o n Q u e r y -> TDecisionCube -> TDecisionSource
TDecisionSource
TDecisionGrid TDecisionGraph.
TDBGrid,
( , TDBChart).
.
TDecisionQuery, TDecisionCube, TDecisionSource TDecisionGrid,
. , SQL
TDecisionQuery, :
SELECT Sales.SaleDate, Items.Item, SUM( Items.Price * Saleparts.Qty )
FROM Sales
INNER JOIN Saleparts
ON (Saleparts.Sale = Sales.SaleNo)
300
-
.~i,j-..-ii
TOecisionGraph
255.718 , 2002
275.557 . 2002
334,839 , 2002
128,592 . 2002
, 2002
, 2002
, 2002
SaleDate
, 2002
. 5.17. ,
TDecisionGraph
DecisionCubel. DecisionQuery 1 (
DataSei) Decision Cube Editor Dimension
Settings. Available Fields SaleDate
( Month
Grouping). , ,
.
DecisionGridl DecisionSourcel, aero,
, DecisionCubel. . 5.16.
, Items
, SaleDate .
, .
, , .
,
5.
301
.
.
+ -. , ()
() , .
. Drill in
to this value, .
. , .
TDecisionGrid, Decision Cube
.
TDecisionGraph. , .
TDecisionGrid,
TDecisionGraph, DecisionSourcel. SQL DecisionQueryl Item Items (
Item ). , Active
DecisionGraphl true. . 5.17.
, -, .
TDecisionPivot.
.
, , TDecisionGrid. TDecisionPivot, DecisionSourcel. SQL
DecisionQueryl :
SELECT Sales.SaleDate, Items.Item, SUM( Items.Price * Saleparts.Qty ),
COUNT( Items.Price * Saleparts.Qty )
FROM Sales
INNER JOIN Saleparts
ON (Saleparts.Sale = Sales.SaleNo)
INNER JOIN Items
ON (Items.ItemNo = Saleparts.Item)
GROUP BY Sales.SaleDate, Items.Item
SQL , ,
. DecisionCubel
. DecisionQueryl, Active
true. . 5.18.
302
Form!
Item
" 0
(
10.0Gb Fujitsu f>/
, 2002
:15"(13.8")LGSt
j15"(13.8")LGSt
; 15" Samsung 15
! 15" Samsung 15
15" Samsung 15
; i15" Samsung 55
i15" Samsung 55
j15"Samtron5BE
;15"SonySDM-h
;17"(16")Samsu
:
'
113.00$
'
2002
[Jiijl
SaleDate
:
792.00$
396.00$
113.00$
339.00J
1,402.00$
1,605.50$
988.00$
2.048.00$
1.024.00$
464.00$
290.00$
853.33$
-187.00$
974.00$
373.33$
26.7$
350.00$
307.50$
328.00$
492.00$
23B.QO$
238.00$
238.00$
1,B01.67t
961.00$
519.75$
.; 1
210.00$
961.00$
378.00$
1
. 5.18. TDecisionPivot
TDecisionPivot .
. , .
. : ,
.
.
,
. .
, , . , /
,
, .
Decision Cube, ,
.
,
, . ,
Decision Cube.
Quick Report Decision Cube. , ,
5.
303
. . TQuickRep,
. ,
, (TQRLabel, TQRDBText, TQRExpr TQRSysDatd). ,
TQRBand TQRGroup . Quick Report, .
, Decision Cube
, . TDecisionCube, TDecisionQuery, TDecisionSource, TDecisionGrid, TDecisionGraph
TDecisionPivot .
TSQLQuery 261
TSQLStoredProc 261
TStatusBar 75,130,284
TTable 34,42,159
TUpdateSQL 182
168
164
164
85
217
163
209
229
34
TField 75,78
TDataSet 34
TDBGridColumns 143
34
TBatchMove 132,189
TDataSource 42,72,131,262
TDBChart 131
TDBCtrlGrid 135,270
TDBGrid 136,291
TDBLookupComboBox 91,131,263
TDBLookupListBox 130
TDBNavigator 40,129
TDBRadioGroup 131
TEdit 42
TListView 49,105,246, 282
TSession 114, 115
TSQLConnection 236,240
ARRAYOFCONST 62,68
OPENARRAY 62,68
Abort 69
AddAlias 100,119,120
AddFieldDef 101
AddlndexDef 101
AddStandardAlias 100,119,120
AnsiPos 64
Append 68
ApplyRange 51,264
ApplyUpdates 94
Assign 80
Bookmark Valid 71
Cancel 67
CancelRange 51, 119
CancelUpdates 94
Clear 81
Commit Up dates 94
Date 88
DecodeDate 88
Delete 68
DeleteDatabase 121, 144
DeleteTable 67,120
DropConnections 121
Edit 68
EditKey 60,247,254
EditRangeEnd 51,121,264
EditRangeStart 51, 118
FieldByName 49, 118
FieldByNumber 49,111
FindFirst 63,267
FindKey 61
FindLast 63,146,155
FindNearest 61,120
FindNext 63,110,261
FindPrior 63
GetFieldNames 111
GotoKey 60
GotoNearest 61
Insert 67
IsAlias 100
IsEmpty 88
IsNull 88
LoadFromFile 143
LoadParamsFromlniFile 236
Locate 62,142
Lookup 62
MoveBy 41,110
OpenDatabase 121,267
Post 67
Prepare 182
RemoveAllPasswords 118
RenameTable 67
RestoreDefaults 143
SaveConfigFile 120
SaveToFile 143
SetKey 60
SetRangeEnd 51,181
SetRangeStart 51
StartTransaction 110
Substring 88
MyBase 263
263
103
20,24
Between 165
Exists 165
In 166
Is [Not] Null 167
Like 166
82
82
82
89
177
From 162
Having 168
Group By 168
Order By 169
Select 161
226
20,21,106
305
306
48,82
136
93
231
ActiveStatements 247
AllowStreamedConnected 238
Aslnteger 53
AutoEdit 74
AutoGenerateValue 79
Bof 41
Bookmark 70,130
ButtonStyle 138,263
CachedUpdates 93,183
CanModify 69
Columns 136
DataType 79,138
DefaultExpression 80
Delta 267,282
DriverName 106,267
Eof 41
FieldDefs 82,101
FieldKind 79,150,270
Fields 47,106
Filter 57
Filtered 57,105
FilterOptions 57,58,140
IndexDefs 101
IndexFieldNames 50, 60,115, 246
IndexName 50,60,130
Islndex 80
IsNull 80
KeepConnection 235
KeepConnections 116
ListSource 130
LoadParamsOnConnect 235
LookupCache 91,267
Options 144
Readonly 69,190
RecNo 156
RequestLive 179,263
RowsAffected 182
SessionName 115,235
State 72
UpdateObject 187,188
UpdatesPending 94
ViewStyle 49,106,246
-- 73
20, 24
AfterPost 96,158
AfterScroll 44,250
BeforeApplyUpdates 267
BeforeUpdateRecord 269
OnCalcFields 85,149,152
OnCellClick 158
OnChange 81
OnClose 59,113,273
OnColEnter 158
OnColumnMoved 158
OnCreate 59
OnDataChange 74,114,249
OnDrawColumnCell 153
OnEditButtonClick 139,140, 267
OnFilterRecord 60, 63,188, 268
OnGetText 81,116
OnReconcileError 78,267
OnSetText 82
OnStateChange 74,114
OnUpdateData 74,191
OnUpdateError 78,95
OnUpdateRecord 94
OnValidate 81,117, 118, 271
TLocateOptions 62
109
219
Cast 172
Extract 172,249,251
Lower 171
Substring 171
StrToIntDef 44
Trim 172
Upper 171
X
223
Database Desktop 26
SQL Explorer 20
307
.
.
ISBN 5-93772-049-fl
70x100/16, , 896 .
SAMS
.
. ,
. (, ..), . ,
, . -
,
web- www.diasoft.kiev.ua.
,
99.
.
,
.
1.
2.
3.
4. /
5. ,
6. :
7. :
8. /
9.
10.
11.
12. ,
13. /
14.
15.
16.
17.
.
.
.
C++.
.
ISBN 5-93772-073-3
70x100/16, . , 1104 .
SAMS
C++ ,
ISO/ANSI.
C++. ,
. ,
C++, C++,
, , , -
, , STL, RTTI .
.
. , ,
.
, .
1.
2. C++
3.
4.
5.
6.
7. C++
8.
9.
10.
11.
12.
13.
14.
C++
15. ,
16. string
17. /
.
. C++
. ASCII
D.
.
F. STRING
G. STL
.
I.
ANSI/ISO C++
J .
#.
.
ISBN 5-93772-052-0
70x100/16, ,
656 .
SAMS
#, ,
.NET. ,
- , , "" . - , , , , ,
, -
. , , ,
, . , #.
1. :
2. #
3. #. I
4. #: II
5. - #
6. . I:
7. . II: ,
8. . I:
9. . II:
.
10. . I:
11. . II: ,
12. . I:
13. . II:
14. . III:
15. ,
16. . I:
17. . II: , ,
18.
19.
20.
21. , XML-
22. -
23.
.
.
. #
D.
. Unicode
F. DOS
C+ +
C++
/ /
/
tail 1-4
tarn
Ei ||
i|u
: tllllpnl
kn
, :
, ?
? ?
? :
,
.
, , " ", ,
.
, . ,
( ) .
,
- .
(, ),
"", "", "" .
""
"" (, !)... , ? , ? , ,
( , -
ISBN 966-7393-89-5
70x100/16, . ,
688.
,
""
, ,
, )? ' ?
: () , ,
.
,
. ,
.
,
"". ,
, .
( , ).
C++.
ISBN 5-93772-054-7
70x100/16, .
496,
unpm
<|
, , , .
, , .
, , , , - .
C++ .
, :
, ; ; . , .
(
, ), ,
.
5.
17.
18.
19.
20.
21.
22.
,
. 1-5
/ ///
ISBN 5-93772-083-0
70x100/16, . , 1136 .
, , , "". , , .
, , , , -
. "".
. , .
( , ),
"", .
. 1-4
/ //
ISBN 5-93772-081-4
70x100/16, . , 672 .
. 5
ISBN 5-93772-082-2
70x100/16, . , 480 .
@
( - )
@. ,
. i
. :
, -, <
www.diasoft.kiev.ua.
:
;
, ;
;
;
.
, , ,
, , - , (
), , , ..
www.diasoft.kiev.ua
,
, , ,
.
, .
(
). ( , ,
) " ,
, . , , .
, 5%
( + 1000 ).
; .
10% .
,
www.diasoft.kiev.ua.
1.
.
2. , , ( ) ?_
3. ...
4.
5.
6. , , e-mail, web-
"
: , 03055, -55, / 100, .
. _| 1 1 \
. \ci/
1
""
.
, 1
AL^V
-
-
- , 105, . , .""
190103. - , 44, / 66,000 ""
,
(
'
9>
:S '
S:l
W
.(0562)33-27-74, 34-02-09
-: 49008, \ 466
e-mail: diasoft@mail.dnepr.net
.
. (0572)47-20-67
e-mail: books@rail.kharkov.com
./. (0322)39-87-08
e-mail: vlas@txnet.com
. (095)726-80-67
e-mail: diasoft_msk@rosmail.ru
-
.(812)251-41-94
e-mail: diasoft_spt@mail.convey.ru
190103, \ 66
000 " "
"', . , 46
. (044)224-22-91
" ",
.,51 . (044)227-25-1
"", - , 29
. (044)274-52-35
" ",
- 40- , 100/2
. (044)263-20-54, 263-20-04
./ (044)263-60-56
" ",..
. (0572)47-80-20
" ",
., 1
. (0562)33-09-55
" "
.. 40
. (0562)744-86-72
"", - , 98,
. (0562)43-63-81
"'. 83
. (0622)382-64-69
"-"
. 1
. (0564)92-37-32
"Books", . , 51,
. (0572)14-04-71
"", ..6
. (095)928-87-44
" ",
-, 40, . (095)137-60-38
" ",
. , 8
"", -, 78
. (095)152-45-11
" * .2- ,54
. (095)978-50-47, 978-55-07
" ", . ,28
. (095)238-11-44, 238-00-32
-
" ", -, 28
.(812)318-64-16
" ",
. , 2,
.(812)164-65-65
"", -, 189
.(812)443-01-47
" XXI"
- ., 92,
.. ,
. (0172)64-31-05, 64-27-97
1) - ,
2) .
3) ,
e-mail.
4) mail.
1
5) ,
, .
0 - ,
( . , )
2)
3) ,
e-mail.
4
)
e-mail.
.
! .
5) , , .
, , .
.
, .
7 .
.
2003
:
:
- :
:
:/
E-mail: _
- :
.:03055/ 100, ./(044)212-1254,216-3564-1:
books@diasoft.kiev.ua
stepanb@akcecc.kiev.ua
190103, / 66 " "
www.diasoft.kiev.ua
4043
7277
6173
7261
7276
6169
6583
4020
4683
6538
- ""
., /: .
. 2-;
.
.. . 2-
, , , >
, +. . ,
., ; , 8 .
"
584
496
736
624
704
688
816
548
544
432
84x108/16
70x100/16
/0x100/16
70x100/16
/0x100/16
84x108/16
84x108/16
84x108/16
60x84/16
70x100/16
Microsoft Windows 2000 Professional.
.
Microsoft Windows 2000 Server.
. . Windows XP Professiona
Teppf Microsoft Windows XP
Linux.
( Linux. . 2- . flononh
.
Red Hat Linux . ,
.
Red Hat Linux 7
Jnux IP Stacks
( + CD-ROM )
.inux 5.2. + 2 CD-ROM
, fit Red Hat Linux 7.x
. , Unix .
, UNIX Internet ^+ CD-ROM
44 .
OS/2 Warp
r
6496
reeBSD.
6982 Solaris 8.
832
672
336
848
752
720
672
448
288
688
880
864
496
352
736
928
70x100/16
70x100/16
70x100/16
70x100/16
70x100/16
70x100/16
84x108/16
70x100/16
70x100/16
84x108/16
70x100/16
60x84/8
84x108/16
60x84/16
70x100/16
70x100/16
5511
5954
6521
6884
6455
6523
5717
6174
5758
3926
6718
1557
4318
5003
6522
5953
6704
6894
6905
7167
7168
6913
7464
7463
7465
6885
6914
5804
4754
3621
2757
.
Windows 2000.
640 84x108/16
1024 70x100/16
52 84x108/16
432 70x100/16
.
256 "0x100/16
Word 2002. . ... ... ;
.
240 70x100/16
Excel 2002. . . ... ..
6104 < ..
.
656 70x100/16
6623 . . Access 2000. .
544 84x108/16
5096 . " Access 2000. ;
-.
800 84x108/16
4925 , OracleS . ( + CD576 84x108/16
Oracle 8/8i Server.
5057 "
864 60x84/8
Oracle 8. . . 2-, .,
6168 AIS
560 70x100/16
6728 5
Oracle 9i
Oracle . 1
672 70x100/16
7217
816 70x100/16
6965 . SQL.-99. .
688 70x100/16
5640 MS SQL Server 2000.
608 70x100/16
6729 " PostgreSQL.
800 60x84/8
2010 - . nformix.
.
496 84x108/16
2472 . Adobe Photoshop 5 ( + CD-ROM )
.368 70x100/16
6694
Adobe Photoshop 7.0.
762 70x100/16
7262 ; Adobe Photoshop 7.0. .
400 70x100/16
7218 Adob Illustrator 10
848 70x100/16
7219 - Adob Illustrator 10
528 70x100/16
7148 < . CorelDRAW 1 1
1024 70x100/16
7147 { . CorelDRAW 1 1
624 70x100/16
6171 , ; 3D Studio VIZ 3 + CD-ROM
570 .
3D Studio . 1 ( + CD-ROM )
752 84x1 08/8
649 . 3D Studio 2- ( + CD-ROM )
432 84x108/16
368 84x108/16
2860 .. X 3D Studio MAX 2. 2:
3925 3D Studio 2. 3: ( + CD-RC
408 84x108/16
720 84x108/16
5080 .
3D Studio MAX 3: ,
456 84x108/16
4634
3D Studio MAX 3 : ,
6925
3D Studio MAX 4/5 .
832 70x100/16
464 70x100/16
7278
3D Studio MAX 5. 2-
4 ( + CD-ROM >
336 70x100/16
5029 .
6170 . BRYCE + CD-ROM
656 84x108/16
5069 Flash 4 . ( + CD-ROM )
448 70x100/16
6094 ..
Flash 5.0. . . . ..
240 70x100/16
864 70x100/16
6195
Lightwave 6/7 :
6915 OpenGL
512 70x100/16
6803 By
OpenGL.
592 70x100/16
.
5163
704 60x84/16
PageMaker ( + CD-ROM )
6566 Ado Page Maker 7.0 . Adobe
384 70x100/16
7061 QuarkXPress 5. .
912 70x100/16
6844 PDF Adobe Acrobat
384 70x100/16
CAD-.
4753 AutoCAD 2000. ( + CD-ROM )
688 84x108/16
6926 . AutoCAD 2000/2002. .
784 70x100/16
6780 . . AutoCAD 2002. . .
528 70x100/16
6559
944 70x100/16
AvtoCAD 2002 .
6235
Mechanical Desktop 4,5,6.
304 70x100/16
, .
3947 . . 1: High-Performance Networking.
432 60x84/8
3927 . . 2: Networking Essentials
432 84x108/16
6384
736 70x100/16
6843
256 70x100/16
6785
TCP/IP.
576 70x100/16
6893 IP-. , ,
512 70x100/16
1295 . Microsoft BackOffice 2. ( + CD-R
800 60x84/8
6454 ..