EPUB | CHM | PDF

TMySQLDirectQuery

Top Previous Next

note Since v2.5.7

TmySQLDirectQuery TMySQLDirectQuery component is intended for high-speed (3-4 times faster than with using of TMySQLQuery component) data fetching.

Description:

TMySQLDirectQuery allows to execute SQL queries and retrieve resultsets with very high performance. Meanwhile, it is not TDataset-compatible. This means that it can't be assigned to TDatasource.Dataset property and you can't use it with visual DB-controls. TMySQLDirectQuery is usually used in tasks where data require some processing without displaying it with/within visual DB-controls.

note There are two nice examples of usage of this component:
 
1. Table2txt - This example shows how to save MySQL table data to a text file (one record per line). Fields values are delimited by TAB character. To increase performance we used TMySQLQueryDirect component.
 
2. TMySQLDirectQuery demo - allows you to compare TMySQLDirectQuery and TMySQLQuery performance on data fetching.
 
You are welcome to download examples at http://microolap.com/products/connectivity/mysqldac/download/

This component is used only for fetching data. That means that you can run queries that return resultset (SELECT, EXPLAIN, SHOW and so) with this component. If you need to run data modification or administration queries (INSERT, CREATE TABLE, COMMIT and so on) you can use TMySQLDatabase.Execute method. If you need to get single value from database (1 row X 1 field resultset) you can use one of TMySQLDatabase.SelectXXX methods.

See also: Properties, Methods