Carapace uses ActiveX Data Objects (ADO) for connecting to databases. ADO provides an interface onto a wide variety of data sources including relational databases, such as Oracle or Sybase, or the Microsoft Active Directory Service.
This section concentrates on accessing relational databases via ADO.
The Db object exists to give simpler access
to databases -- it uses the ADO access itself.
There are three main objects when accessing a database via ADO:
Connection |
This is the connection
onto the database. The connectionString property defines
the particular database to be used. Transactions are controlled
with the beginTrans and commitTrans methods.
Most of the real work is done via the |
Command |
The Command object is used to execute general commands
on the data within the database. These commands can have
parameters - for example, the command may be a database insert
command: the parameters are then the data elements to insert.
The main method on a |
RecordSet |
The RecordSet object resembles a window onto a set
of data contained in the database. This window can be used for
viewing the data as well as modifying it.
|
All the ADO objects are accessed via COM. The following fragment of Carapace script creates the types of ADO object described above:
(create Dispatch "ADODB.Connection")
(create Dispatch "ADODB.Command")
(create Dispatch "ADODB.RecordSet")
The ADO objects give you highly flexible access to the data in the database. However, this flexibility comes at a price -- the ADO objects are rather complicated to use.
To help you, the Carapace Db object
wraps up the ADO objects. You can use the Carapace methods for high-level control,
and yet still access the ADO objects underneath if you need finer control
for specific tasks.
| Contents | Index | Current topic: databases | Related topics: objects, functions |