PmAdo - Deatiled object description

See: Object PmAdo
The PmAdo object contains a single database connection (ADO Connection). The database connection is executed by the DbOpen method. The following actions can then be executed over the database:
1) SQL commands not returning data in the form of AdoRecordset object: using the DbExecute method, for example INSERT, UPDATE, DELETE, CREATE TABLE, etc.
2) SQL queries returning data in the form of AdoRecordset object: using the RsOpen method, for example SELECT, etc.
Each query that creates the AdoRecordset object (RsOpen or DbExecute) can have unique identifier (sId), that is used to store the result of the query by the PmAdo object. If the unique identifier is used, then the corresponding AdoRecordset object can be obtained by the RsGet method, or it can be closed by the RsClose method. The PmAdo object may simultaneously contain multiple SQL query results in the form of AdoRecordset objects.
Wrapper object:

The way of implementing methods and properties (e.g. AdoRecordset.Update) for all ADO objects (e.g. AdoRecordset, AdoField, AdoRecord) causes instant halt of script on any error(s) in the sctipt that called the method. This is unfavourable behavior. Therefore the PROMOTIC wrapps automaticaly each ADO object with own security layer (the Wrapper object). The Wrapper allows to call all methods and properties of any object that is inside the Wrapper. The Wrapper catches possible errors in the original object and remembers the code of the last error. It prevents the halt of script caused by error that may occure by calling the method of the ADO object. The object wrapped in the security layer of the Wrapper object is best observed as the original object, because the layer allows to access all methods and propertiers of the wrapped object. It also adds new properties used for testing the results of last operation with the object (success/failure). IF any method or property of the original object returns a reference to another object, then the Wrapper of the original objects wrapps the reffered object with a new Wrapper object. This way it is secured that all ADO objects in the hierarchy are wrapped with the security layer automatically.

Properties added by the Wrapper object to the methods and properties of the ADO object (e.g. AdoRecordset, AdoField):
- Pm_LastErr - Returns the numeric error code of the last executed method (property) over the object (the 0 value means no error).
- Pm_LastTextErr - Returns the text description of the error of last executed method (property) over the object.
Accordingly, it is possible to read the result of the last operation for DbExecute and RsOpen by the LastErr and LastTextErr properties directly in the PmAdo object.

Reading the result of the last operation (over the objects PmAdo, AdoRecordset, AdoField) is handy in situations, when there is no way to estimate the result of such operation and while the method itself does not return the result of the operation. For example DbExecute, RsOpen, AdoRecordset.Update. See Example.

ADO Record object:

Depending on the specific ADO Provider it is possible, that a single row SQL query result will not be returned as AdoRecordset object containing a single record, but as a AdoRecord object, representing the single row. Není to ale typické pro nejběžněji užívané ADO Provider. The AdoRecord object is usually returned by explicit operations, when the specific AdoRecord is returned from the existing AdoRecordset object. The AdoRecord object consists of multiple AdoField objects, similar as the AdoRecordset object. The difference is that the methods for moving the position of current record are not supported (e.g. MoveFirst). In order to keep the documntation simple, it will be referred only to the commonly returned object AdoRecordset, although in some special cases the system may also return the AdoRecord object.

Asynchronous programming:

Some operations over the database can also be executed as asynchronous.

Caution: Asynchronous programming frequently causes comlications, therefore it is recommended to use the synchronous attitude. In case there is a chance, that the synchronous requests may take too much time and there is a possibility of timeout, then it is recommended to execute all operations in the working thread (See PmSequencer").

For additional information regarding the ADO technology see, or
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice