home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 October
/
Chip_2001-10_cd1.bin
/
zkuste
/
delphi
/
kompon
/
d45
/
ARDOCI.ZIP
/
dOCI_README.eng
< prev
next >
Wrap
Text File
|
2001-07-13
|
15KB
|
381 lines
dOCI 1.10 stable
=================
========================== IMPORTANT =============================
Now components have a new author. It is me - Romanchenko Andrey.
The previous author - Alex Buloichik gave all rights me on dOCI
package of components.
Now I will glad see any questions and suggestions.
You can send it me on e-mail : lasersquard@yahoo.com, roma@axioma.da.ru
===================================================================
========================== IMPORTANT =============================
If you are using the old version (0.9) of components you may have
some troubles while upgrading to newest versions. The versions begin
with 1.0 are more compatible with delphi standart components.
For example early you must add fields using call
OraSQL.Query.AddField(..) but now you can do it so :
OraSQL.FieldDefs.Add(..) - as in delphi standart components.
===================================================================
Components are tested and good working with Delphi 4,5. It is quite
probably that they will work in Delphi 3 without any modifications.
(early they worked on delphi 3 but new modifications are not tested on it)
My contact e-mail is lasersquard@yahoo.com, roma@axioma.da.ru
================================================================================
============
FEATURES !!!
============
- Do not requires BDE! Application will not need to install BDE. Thre is no troubles
with different verions of BDE.
- Can work with Oracle 7.* and 8.* using client part from Oracle 8.
- Powerful descendant TDataSet - TOraSQL. Implements all possibilites of TDataSet and
addes new.
- Full implementation of ORACLE BLOB and CLOB fields.
- Possibility to execute stored procs.
- Posibility to execute parts of PL/SQL code big length without creating stored
procedure.
- You can customise number of records which will be fetched from Oracle Database
during one access to server (much more increases performance on large tables).
- Quick and powerful tables in memory (TMemoryDataSet, TAMemoryDataSet).
- Many nice components for create and work with dynamic arrays for all types of data.
(search in this arrays implemented on assembler and very fast!)
CONTENTS
Introduction
License
Common description
How I can deal with it
Description
Examples
Productivity tests
ChangeLog
Introduction
------------
Components are developed for get access to ORACLE 8 Server from Delphi 4,5.
They are use standart library OCI (Oracle Call Interface).
To use components you need installed Oracle Client for Windows 9x/NT/2000 on
you computer.
The library maintain data types BLOB and CLOB.
From version 1.0 BLOB and CLOB fields are work good in TOraSQL.
You can get access and to ORACLE 7 Server using clients from ORACLE 8.
If you want use Delphi 3 you can correct source code and send me changes.
I say thank you and include your changes in next version.
Version 1.0 it is a stable version because now it work in real project in my
firm. Since version 0.9 many bugs was corrected and now components work
quickly and stable.
I trying to do components much more better and I wait your recomendations and
suggestions. If you find bug in components please drop me a letter. I will try
to correct and send you a corrected version.
Now I am about to make web site where you can find new versions and other information
about dOCI components and other my programs.
if you want receive the newest version you can write me a letter.
My e-mail - lasersquard@yahoo.com,roma@axioma.da.ru or 2:450/93.30 in FIDO.
I didn't implement ßached updates and fields LargeInt.
If you need send me a letter I will implement it.
LICENSE
-------
Components are Freeware with source code.
You can use components in any project (and in commersial too).
You can do any changes in source code but you should inform me about this changes.
COMMON DESCRIPTION
------------------
Now implemented the next data types:
String,
Boolean,
Float,
Date,
Time,
DateTime,
Integer,
SmallInt,
Word,
Currency,
BLOB,
CLOB;
This data types implemented in fields and params.
Float ¿ Integer - as is.
Boolean - as NUMBER(1) - 1 byte. 0 = False, >0 = True.
String - as array of char in memory with fix length as the length of field.
Date - stores as TTimeStamp.Date(integer) - days from 1.01.0001
Time - stores as TTimeStamp.Time(integer)
DateTime - stores as TTimeStamp
TOraDB -is the connect to ORACLE database and transactions control.
All components (such as TAOraSQL) use this component to connect with the
database. All OCI calls are concentrated in this component.
TAOraSQL - immediatly make OCI calls (SQL queries or parts of PL/SQL source
code). It is a fullfunctional component and can be used when the compatibility
with TDataSet is not necessary, for example in case when we want to execute
stored procedure or part of PL/SQL source code or SQL query which results
we don't need to show in TDBGrid.
This component works much faster than TOraSQL because it doesn't need
additional actions as TOraSQL concerning the compatibility with TDataSet.
TAOraSQL can get access to data using the record number.
During one access to database TAOraSQL fetch as many records as is in
FetchCount's properties. If you work with big tables you should make
FetchCount larger. By default FetchCount=100 what corresponds to the middle
size of databases. If you call method Open the SQL Query opens but any data
won't be fetched. To fetch all data after Open you may use method ReadAll
or OpenAll instead of Open and Readall. If you need a part of data you may
use ReadRecord(RecordNum) method that will fetch FetchCount records for
one access to database till RecordNum or more records will not be fetched.
TOraSQL - is the wrapper around TAOraSQL for compatibility with TDataSet. It
is very similar to TQuery and TStoredProc. You can type SQL Query, fields
(in runtime and designtime). The work with TOraSQL is similar with Delphi
standart database access components. By default, TOraSQL reads as much
records as is needed for TDBGrid. To read more records call OpenAll, ReadAll
or VGoto.
TAOraUpdateSQL - is a component for linking to TOraSQL. You can type SQL
Queries to change data in tables such as INSERT,DELETE,UPDATE. It is similar
to standart TUpdateSQL in Delphi but it doesn't have SQL query editor as
in TUpdateSQL. That's why you should type queries manual using DeleteSQL,
InsertSQL,ModifySQL properties.
dOCI Files:
DynamicArrays.pas - my components to work with dynamic arrays and used by
many other components.
You can use this unit separatly from dOCI components because
it consists many useful classes for work with arrays.
VirtualDataSet.pas - descendant TDataSet for convenience.
DataSetQuery.pas - descendant TVirtualDataSet which implements 90% functions
of end user components. This class very intersting for developers
because by override some methods you can do an good component for
access to any data (for example you can do MemoryTable and OraSQL).
OraDB.pas - includes class TOraDB for connect to Oracle Server. The analog
of TDatabase in Delphi.
AOraSQL.pas - includes TAOraSQL and TAOraField, TAOraParam used by TAOraSQL.
OraSQL.pas - includes the main component TOraSQL.
OraDefines.pas - some constants and definitions for OCI calls.
OraError.pas - includes class EOraError descendant Exception.
INSTALLATION
------------
Open package dOCI.dpk (dOCI5.dpk in Delphi 5). Push sequently buttons "Compile"
and "Install".
Thats all.
You can find components on "Data Access" page of pallete components in Delphi.
How I can deal with it
----------------------
Description
-----------
TOraDB - for connect to Oracle Server (as TDatabase in Delphi)
Properties :
Active - ¿ Γᬠ∩ß¡«
DBLogin, DBPassword - ¿¼∩ ¿ »áα«½∞ ó íáºπ
DBServer - ß¿¡«¡¿¼ ßÑαóÑαá ¬ ¬«Γ«α«¼π ¬«¡Ñ¬Γ¿¼ß∩ (ß«ºñáÑΓß∩ ß »«¼«Θ∞ε "Oracle
Net8 Easy Config" ½¿í« απτ¬á¼¿ »α«»¿ßδóáÑΓß∩ ó Σá⌐½Ñ
%oraclehome%/net80/admin/tnsnames.ora)
OraSessionIsolationLevel - isolation level for transactions. Applies to all
transactions in current session.
OraTransIsolationLevel - isolation level for each new transaction.
if OraTransIsolationLevel=tiDefault the OraSessionIsolationLevel is
used.
Methods:
Open,
Close - ßonnect/disconnect.
StartTransaction,
CommitTransaction,
RollbackTransaction - transaction control
TOraSQL - queries to Oracle Server (descendant TDataSet)
Properies :
Database - which database use (TOraDB)
SQL - query text (as usual parameters begin from ':')
Params - list of params.
FetchCount - for SELECT - how much records will be fetched to one access to
server. Value 1 is the same as BDE.
Prepare - prepares query to execute. Usefull if you many times execute one
query with different values of params. Not mandatory.
UnPrepare - unprepares SQL Query.
I recomend to get access to data using next methods:
GetFieldValue - get field value. Much faster than FieldByName('').As... but
but gets wrong value if record being edited.
GetFieldHArray - get pointer on array of values for specified field.
GetFieldNullHArray - get pointer on array tags Null or NOT Null
(for more information see DynamicArrays.pas)
ReadAll - fetch all records on local machine.
VGoto - fetch all records till specified on local machine.
TAOraUpdateSQL - queries to change data
DeleteSQL,
InsertSQL,
ModifySQL - as is.
You can see examples with TAOraUpdateSQL in OraSQL.pas.
Working with BLOB :
If you work with TOraSQL you can use standart TDataSet methods to get access to
BLOB fields.
For write BLOB data into table you must specify "FOR UPDATE" in SQL query.
See ORACLE documentation for additional information.
For write BLOB data you must use TAOraSQL because TOraSQL support BLOB fields
in readonly mode. I will try to correct this as soon as possible.
TAOraSQL has some functions to access to BLOB fields:
GetLobLength - get size (in bytes) of BLOB field.
ReadBlob - read piece of data from BLOB field to local buffer variable.
WriteBlob - write data from buffer to BLOB field.
ReadBlobToStream - read all BLOB field data into stream (TStream)
WriteBlobFromStream - write data from stream (TStream) to BLOB field.
=============== éìêîÇìêà! ==================
For open SELECT-queries you should call
Open/Close, for other - ExecSQL.
============================================
Examples
--------
1.
Get cursor from StoredProc:
BEGIN :Result := GetData(12); END;
Param Result has datatype ftCursor.
2.
For open SELECT-queries you should call Open/Close, for other - ExecSQL.
If you wish select some fields from one record of table you can use params:
BEGIN SELECT Name,Index INTO :Name,:Index FROM Table1 WHERE ...... ; END;
and get result as
OraSQL.ParamByName('Name').AsString;
OraSQL.ParamByName('Index').AsInteger;
This abit faster than
SELECT Name,Index FROM Table1 WHERE ......
Productivity tests
------------------
results in seconds :
BDE OCI(FetchCount=1) OCI(FetchCount=1000)
INSERT 24 19
SELECT 27 26 4
The tests are execute on :
server - oracle 8.0.5(linux) - p-200/64ram
client - NT4 - pII-233/64ram
network - 10mbit
the table has size 10000 records
CHANGE LOG
----------
v 1.10 (06.04.2001)
* Added virtual method CreateAField. Now TADataSet can hold list of fields descendances
of TAField.
* Removed method AddField from TAOraSQL. CreateAField works insted of AddField.
* Added check on empty query text. Now you will see instead of strange "Zero iteration
counter" "SQL statement is empty."
v 1.09 (19.03.2001)
* Added method OpenDatabase in AOraSQL.
* Added editor for AOraUpdateSQL as standart Delphi Query Editor. Now you don't need
to create queries by hands.
v 1.08 (27.02.2001)
* In error message errorcode appeared twice.
* Errors with code 20010-20050 are reserved for user information messages
EOraError cuts all debug information from this messages.
For additional information see OraError.pas
v 1.07 (08.01.2001)
* Events BeforeInitOCI and AfterInitOCI added. You can change OCI libriary
name, disable initialization.
* Property OraSessionIsolationLevel ¿ OraTransIsolationLevel added.
You can customise Isolation level for whole session or for each transaction.
You can see ORACLE documentation for additional information about isolation
levels.
v 1.06 (21.12.2000)
* CopyStructure(DataSet:TDataSet) and CopyStructure(ADataSet:TAdataSet) added.
in TADataSet.
v 1.05
* in ADataSet.pas some comments translated into English.
* Check source code of AOraSQL.pas ADataSet.pas AMemoryDataSet.pas and correct
error messages and some bugs.
* Rename some methods in TADataSet.
* Move method AddField from TAMemoryDataSet to TADataSet.
* List of params is creates in TADataSet not in your descendants.
v 1.04
* GetLobLength added in TAOraSQL.
v 1.03
* In TDataSetQuery field Query moves from public to protected.
It helps easy find erors if migrate from ver 0.9 to 1.03 and later.
v 1.02
* Added events to TOraDB:
BeforeLogin (have param Accept),
AfterLogin, BeforeCommit, AfterCommit,OnStartTransaction.
v 1.01
* Fixed bug with OldValue if no edit present.
* Method Refresh reopens query.
v 1.0:
* Many fixes. More compability with standart Delphi components.
* BLOB support added in TOraSQL (readonly). For write you can use TAOraSQL.
* Autocreate list of Params from SQL query.
With best regards,
Andrey Romanchenko. lasersquard@yahoo.com,