Morphic Molecules
TDualQuery
A Delphi VCL Component
These pages and Morphic Molecules Components, VBX's,
XCMDs, VCLs, and images
are Copyright Mona M. Everett, Ph.D., 1995
everett@txdirect.net
Morphic Molecules Home Page
Morphic Molecules Services
Member of
the Internet Link Exchange
TDualQuery
History
TDualQuery was derived from David Berneda's 16 bit QBE component.
Unfortunately, the BDE handles query execution somewhat differently in Windows
95 so the source will not compile with 32 bit Delphi. Grant Carpenter made an
attempt to fix the problem, and, indeed, produced a component which would
execute a QBE query for 32 bit Delphi. However, some of the other functionality
of the component was sacrificed for the substantial gain.
After a considerable amount of digging around in the BDE, I was able to
modify the original component that it would execute in a 32 bit environment and
still allow answer table specification and params. I added some additional
properties and methods to make it a little easier to use. Finally, since the
BDE will happily execute either a QBE or SQL query if you tell it which one it
is looking at, I set up the component to deal with either type of Query.

Properties and Methods
Properties from QBE
- AnswerTable
- RequestLive
- BlankAsZero
- AnswerType
- AuxTables
|
New Properties
- QLines
- QParams
- QueryLanguage
- Filename
|
Methods from QBE
- InsertParam
- ClearParams
- GetAliasPath
- GetDBTablePath
- SetQuery
|
New Methods
- SetQueryLang
- LoadFromFile
- SaveToFile
- DeleteParam
|

Functionality
- Query
- This control will execute any query which you can design in the BDE which
will run with local SQL. You must set the QueryLanguage property appropriately.
You can also use the setQueryLanguage(qtQueryLanguage) procedure. Query
Languages allowed are QBE (qtQBE) and SQL (qtSQL) The Query is
entered with a memobox or you can use SetQuery(tStrings).
- Parameters
- Since params are dealt with via a simple string search and replace,
virtually any text can be a parameter. You are limited to 10 parameters of 255
characters each. Parameters are entered in a memobox, one parameter per line and
with the param and its replacement separated by a comma. This is CASE and
CHARACTER sensitive. Do not put spaces around the commas. You can change
QParams directly or use setParams(TStrings).
- AnswerTable
- This much needed feature is not available in regular queries. You can
specify an answer table name as well as its type. If the table exists, it will
be deleted, if possible. In order to delete a table, however, it must be opened
exclusively. If something else has the table open, this is impossible and you
will encounter an error.
- RequestLive
- Request that the rows and columns returned by the query be updatable.
- BlankAsZero
- Return a blank for any field which is zero.
- AuxTables
- Choose whether to use auxiliary tables or not. If you set this to false,
the query can run faster but you will not be able to undo an insert, delete, or
update query.

Known Problems
- Failure to Set Cursor on Non-Result Set Queries
- You will get an EDatabaseError on Insert, Update, and Delete Queries
because there is no result set and the database engine will try to set a cursor
anyway. This has been a problem with the QBE queries and I have been unable to
find a fix for it. TDataset will always try to set a cursor. The TQuery
equivalent command is that of an 'open' and 'execSQL' is not available.
- Unused Parameters
- The component embodies all of the properties and function of TDataset but
some might not be relevant here. Unfortunately, you cannot hide properties in
descendants.

Get
the Component
TDualQuery.zip contains the pascal file, a dcr for the component and this
HTML page. The file is simple enough that the details of properties and methods
can be easily gleaned from the source file. Feel free to email me with problems
you might find with this component. I will try to fix them if I can do so.
Suggestions and fixes are also welcome.

This page was last updated on
Mail comments about Morphic Molecules pages to
everett@txdirect.net