Summary

A lot was covered in this chapter and still there is so much more that could have been discussed. Early in the chapter, we discussed the basic program flow for a CLI/ODBC application and defined it as consisting of three phases: initialization, transaction, and termination. The initialization phase consists of allocating various handles and resources needed to establish a connection to the database and to make that connection. The termination phase did quite the opposite and is the process needed to disconnect from the database and free all of the allocated resources needed to access the database.

The transaction phase is the largest and most complex of these phases. In its basic form it is the phase whereby an SQL statement is executed against the database. This may be to execute a simple query such as an INSERT statement or a more complex query that binds parameter markers to an SQL statement and then retrieves data from result sets returned by the database. This phase can involve complex processing such as column-wise or row-wise array inserts, or column-wise or row-rise binding of parameters to an SQL statement.

The available cursors for the transaction phase was also reviewed. Cursors are used when handling result sets that are made available by the database. These result sets can be retrieved as part of an SQL SELECT statement against the database or more sophisticated cursors can be used to also update rows within the database. One such cursor is the keyset cursor.

Two types of basic cursors are available, a static cursor (or read-only cursor) and a dynamic cursor (or updateable cursor). Some cursors allow you to scroll through the result set cursors and specify which rowset you can read or update. With this cursor type (keyset for example) you can move the current rowset to the beginning, end, or an absolute or relative position within the result set.

At the end of the chapter, we looked at the OLE DB driver and described how to use the DB2 driver or the Microsoft driver. The main OLE DB objects are the Data Source Object—used to determine available data source names, the Session Object—used to generate the rowsets from the data source, the Command Object—for issuing SQL commands against the database, and the Rowset Object—used for returning data from the database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.54.7