ZeosDBO ZEOS Access :
- Delphi 5 - 7 and 9-11
- Lazarus (FreePascal)
- MSEide+MSEgui (FreePascal)
- C++ Builder 5 - 6
- Kylix 2 - 3
( ) :
- MySQL 3.20 - 5.0
- PostgreSQL 6.5 - 8.1
- Firebird 1.0 - 2.0
- Interbase 5.0 - 7.5
- Microsoft SQL Server 7, 2000
- Sybase ASE 12.0, 12.5
- Oracle 9i
- SQLite 2.8, 3.5
:
TZConnection - . , :
ZConection.Properties.Add ('lc_ctype=win1251');
ZConnection.Properties.Add ('Codepage=cp1251');
TZReadOnlyQuery Select. (read only).
TZQuery TZUpdateSQL .
TZQuery:
SQL (TStrings) , Select ;
UpdateObject , TZUpdateSQL, Insert, Update, Delete Refresh ;
Params (TParams) SQL- , Master-Detailed TDataset (TZReadOnlyQuery, TZQuery TZTable);
Connection TZConnection, ( , ), ;
Active - .
TZUpdateSQL:
InsertSQL, ModifySQL, DeleteSQL, RefreshSQL (TStrings) - SQL .
UpdateSQL Editor, TZUpdateSQL.
TZTable - . , TZQuery, .
TZTable:
TableName ;
Filter , , WHERE SELECT;
Filtered .
TZStoredProc , . , SELECT, :
SELECT * FROM MyProc1(:par1, )
, , , . :
|
|
with spSumByName do
begin
Close;
ParamByName ('Name').Value:= 'DontKnowHow';
Open;
Label1.Caption:= ParamByName ('Result').AsString
end;
TZSQLProcessor SQL - , LoadFromStream() LoadFromFile().
TZSQLMonitor , . :
sqlMonitor.FileName:= '.\MyAppLog.log';
sqlMonitor.Active:= True;
sqlMonitor.AutoSave:= True;
:
Procedure Tfrm_MyApp.sqlMonitorLogTrace (Sender: TObject;
Event: TZLoggingEvent);
Begin
If Trim (Event.Error) > '' Then
memMontor.Lines.Add (DateTimeToStr (Event.Timestamp) + ': ' +
Event.Message + #13#10 + ' Error: ' + Event.Error)
Else
memMontor.Lines.Add (DateTimeToStr (Event.Timestamp) + ': ' +
Event.Message);
End; // sqlMonitorLogTrace
TZSQLMetadata (, , .) .
, TZConnection, TZReadOnlyQuery, TZQuery, TZUpdateSQL, TZTable , ( Firebird).
1. Delphi . Name MainForm.
2. (File►New►DataModule), . (Name) DatataModule1 DM.
3. . Unit1.pas MainU.pas, Unit2.pas - DMU.pas, Project1.dpr PrTorgovlia.dpr.
4. , . (File►New►Form), . BorderStyle bsSingle. TovarForm, . TovarU.pas.
5. (F12).
6. Delphi ZEOS Access ZConnection :
DataBase = C:\Inetpub\ftproot\DB\Torgovl_FIOStudenta.fdb - - . ( : MySql , Oracle 11g R2 - SID XE, )
8 ZConnection:
7.
(ZConnection. Connected = True).
8. ZEOS Access TZTable TovarTbl. , Connection = ZConnection1. ( ), , Tovar. TableName - Tovar.
9. DataSource ( DataAccess). DataSource DSTovar. DataSet DataSource TovarTbl.
|
|
10. TovarForm. DataControls DBGrid DBNavigator. Additional BitBtn. Kind bkClose. , 10:
10. TovarForm
11. TovarU.pas.
12. TovarForm c . ( File►Use Unit►UDM)
13. DataSource DBGrid DBNavigator - DM.DSTovar. Tovar, Active true. DBGrid , .
11. TovarForm
: , DBNavigator .
14. , , (2 ) Cena. Tovar .
TDM :
Type
TDM = class(TDataModule)
ZConnection1: TZConnection;
Tovar: TZTable;
DSTovar: TDataSource;
Private
{ Private declarations }
Public
{ Public declarations }
end;
15. , Object TreeView, Tovar, Fields, Add all fields ( . 12)
TDM :
Type
TDM = class(TDataModule)
ZConnection1: TZConnection;
Tovar: TZTable;
DSTovar: TDataSource;
TovarIDTOV: TIntegerField;
TovarTOVNAME: TStringField;
TovarEDIZM: TStringField;
TovarCENA: TFloatField;
TovarTOVGROUP: TStringField;
Private
{ Private declarations }
Public
{ Public declarations }
end;
16. , Object TreeView CENA Object Inspector (. . 13):
: , TField (TovarCENA); FieldName ; DisplayLabel ; DisplayLabel (), . , 50 , DBGrid 20 . .
DisplayFormat , , , ( , currency true). ReadOnly Visible. ReadOnly / , Visible - / .
17. DisplayLabel . DisplayFormat #.00, DisplayWidth 10. DisplayLabel DisplayWidth TOVNAME ,20; EDIZM ., 10; TOVGROUP , 20.
TovarForm :
14.
18. MainMenu . , .
|
|
19. MainForm c TovarForm (. 12).
20. Delphi : Project -> Options, Forms Auto-created forms DataModul DM !!!
21. OnCreate :
DM.Tovar.Active:=True;
22. . Close;
23. ►. : FormTovar.ShowModal;
24. , TovarForm Tovar.
15. Tovar
1. , Name PokupForm, Caption . PokupFUnit. PokupForm DM, PokupForm.
2. 2 DBGrid 2 DBNavigator , .
15.
3. DM ZTable, Name Pokupatel Phone . TableName POKUP TEL.
4. DM DataSource, DSPokup DSPhone, DataSet Pokupatel Phone.
5. DBGrid DBNavigator DSPokup DSPhone, , PokupForm 2 2 , :
16.
, POKUP TEL , TEL, .
: , .. SELECT DML.
Delphi C++Builder TDataset (TTable, TQuery) Master Detail. , TDataSource TTable , Master Detail
Master Detail TZTable POKUP TEL
6. MasterSource Phone TDataSource DSPokup, . MasterFields POKUP - IDPOKUP, LinkedFields TEL - POKUPID.
7. , PokupForm POKUP. DBGrid, Phone , Pokupatel.
17. Phone
Master Detail
. 17 . , Phone . , Visible POKUPID false.
|
|
, Master Detail TZQuery.