Maptitude GISDK Help |
Provides methods for asynchronous Postgres queries,
PostgreSQLCommand( PostgreSQLConnect conn)
Parameter |
Type |
Contents |
conn |
object |
A PostgreSQLConnect connection object |
ExecuteQuery( string qry)
Executes a query.
Parameter |
Type |
Contents |
qry |
String |
A valid SQL statement |
ExecuteQueryWithProgressBar( string qry, array options)
Executes a query asynchronously and shows a progress bar.
Parameter |
Type |
Contents |
qry |
String |
A valid SQL statement |
Options
Option Name |
Type |
Contents |
ProgressMessage |
String |
The message to show in the progress bar |
TimeEstimateInMinutes |
Integer |
The number of minutes the query is estimated to take (defaults to 10 minutes) |
TimerIntervalInSeconds |
Integer |
How often the progress bar should update, in seconds (defaults to 2 seconds) |
NoProgressCancel |
Boolean |
If the progress bar should not offer a Cancel button (defaults to False) |
NoProgressBar |
Boolean |
If the progress bar should not be shown at all (default to False) |
Notes
The TimeEstimateInMinutes should come as close as possible to the time the query usually takes to run. If the actual run-time is less, the query will simply return before the progress bar has reached the end. If the actual run-time is more, the progress bar will still be active but continue to show 100 percent until the query is done.
If the Cancel button is present and the user clicks Cancel, the query will return immediately.
Both this and the ExceuteReaderWithProgressBar() methods can be substituted for their non-asynchronous versions. For queries that take little or no time, e.g., deleting a table, you should still use the synchronous version.
ExecuteReaderWithProgressBar( string qry, array options)
Executes a query asynchronously and shows a progress bar.
Parameter |
Type |
Contents |
qry |
String |
A valid SQL statement |
Options
Option Name |
Type |
Contents |
ProgressMessage |
String |
The message to show in the progress bar |
TimeEstimateInMinutes |
Integer |
The number of minutes the query is estimated to take (defaults to 10 minutes) |
TimerIntervalInSeconds |
Integer |
How often the progress bar should update, in seconds (defaults to 2 seconds) |
NoProgressCancel |
Boolean |
If the progress bar should not offer a Cancel button (defaults to False) |
NoProgressBar |
Boolean |
If the progress bar should not be shown at all (default to False) |
Notes
See notes under ExceuteReaderWithProgressBar()
ExecuteQueryAsync( string qry, array options)
Executes a query asynchronously employing a user-defined callback macro.
Parameter |
Type |
Contents |
qry |
String |
A valid SQL statement |
Options
Option Name |
Type |
Contents |
TimerIntervalInSeconds |
Integer |
How often the timer to check whether the query is complete gets called |
Callback |
String |
The name of a macro to call when the query is complete |
CallbackAction |
String |
A Macro Block to execute when the action is complete |
CallbackValue |
Value |
A macro value of any type to pass to the callback |
If a Callback macro or a CallbackAction macro block is present, it will get called whether or not the query succeeds.
If either a Callback macro or a CallbackAction macro block is called, it will be passed an options array consisting of:
Status: string; "Completed", "Cancelled" or "HadErrors"
ErrorMessage: string; one or more error messages if the query failed.
CallbackValue: macro value; only present if passed in as an option
If you wish to terminate the query before it has completed, you can do so with another "PostgreSQLCommand" Class method: AsyncQueryCancel(), which takes no arguments and does nothing if no asynchronous query is currently executing.
This method is very useful for very long queries, where you'd like the user to be able to continue to use the program, while the query is executing. One way to implement it is with a toolbar that will enable a button when the query is complete. It could also offer a button to cancel the query. Alternatively, you could simply show a message when the query has finished.
AsyncQueryCancel()
Stops the execution of an asynchronous query.
See Also:
©2025 Caliper Corporation | www.caliper.com |