Xbasic

SQL::UpdateStatement::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::UpdateStatement

A SQL::UpdateStatement object.

SQLConnection

SQL::Connection | SQLConnectionString

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. 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::UpdateStatement.SQLStatement property. Note : Not every database is thorough about validation.

Example

dim conn as SQL::Connection
dim connString as C
dim upd as SQL::UpdateStatement
dim sql_update as C
connString = "{A5API='Access', FileName='c:\program files\a5v7\mdbfiles\alphasports.mdb'}"
sql_update = "update customer set bill_city = 'Phoenix', bill_postal_code = '08000', bill_state_region = 'AZ' where customer_id = 1"
? conn.open(connString)
= .T.
? upd.parse(sql_update)
= .T.
? upd.validate(conn)
= .T.

See Also