Xbasic

SQL::Query::Validate Function

Syntax

Result_Flag as L = Validate([SQLConnection as SQL::Connection | SQLConnectionString as C] [UpdateStatistics as L])

Arguments

Result_Flag

TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).

SQL::Query

A SQL::Query object created with a DIM statement.

SQLConnection

Optional. A SQL::Connection object with a defined .ConnectionString property.

SQLConnectionString

Optional. A connection string.

Description

Execute the current statement using the current or passed connection.

Discussion

The .Validate() method prepares the query and validates it, but does not execute it. (In some implementations the query is executed with a limit on rows set to 1). The intent is to force the query through a server side parse and report problems. If successful, the SQL::Query.ResultSet property has a full definition of the columns that would be returned including the underlying table from which the column would be retrieved. The augmentation of the result set with this information is expensive, so it is intended as a design-time tool, not as a run-time option. The method connects to the back-end database using the information in the SQL::Connection::ConnectionString property or in the ConnectString string, then executes the current SQL statement stored in the SQL::Query.SQLStatement property. Note: Not every database is thorough about validation.

See Also