Xbasic

SQL::UpdateStatement Object

Description

The SQL::UpdateStatement object encapsulates the parsing and properties of a SQL UPDATE statement. as a result, it has the most properties. Its children are the various clauses that make up a complete UPDATE statement.

Example 

Note that the fields to update and the corresponding value are specified in a comma delimited list of name/value pairs.

dim conn as SQL::Connection
dim upd as SQL::UpdateStatement
dim cs as SQL::CallResult
dim connString as C
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"
if .not. conn.open(connString) then
    end
end if
if .not. upd.parse(sql_update) then
    ui_msg_box("Error", upd.callresult.text)
    end
end if
if .not. upd.execute(conn) then
    end
end if
cs = upd.CallResult
ui_msg_box("Call result", cs.Text)

Properties

ArgumentsSQL::Arguments

Arguments for the current query.

CallResultSQL::CallResult

Call results.

ColumnReferencesReferenceList of SQL::Query:: ColumnReference

An array of all column references in the query (including nested occurrences). Behaves the same way as .SelectTableReferences.

ConnectionSQL::Connection

Current open connection

ErrorColumnNumeric

The column number of the last error reported by the parser.

ErrorTextCharacter

The text of the last parser error reported.

FunctionReferencesReferenceList of SQL::Query::ValueExpression

An array of all function calls. Behaves the same way as .SelectTableReferences.

ObjectDefinitionsCharacter

For internal debugging. Returns a string description of the mapping between the ANTLR grammar and the Xbasic objects.

ParseTreeCharacter

For internal debugging. A string description of the underlying parse tree.

SetReferenceList of SQL::Query::Assignment

Column = Value objects (SQL::Query::Assignment) to be used in setting values.

SelectTableReferencesReferenceList of SQL::Query::SelectTableReference

An array of all table references in the from clause and those joined to them. This array is created when the property is requested, but can become out of date. Use the Resynch() function on any variable holding this list when any changes are made.

SQLStatementCharacter

A variable that can be assigned a syntax string without parsing it. If no value is passed to the ::Parse() method, this value is used.

TableSQL::Query:: SelectTableReference

The table to be inserted into.

TokenTypeNameCharacter

"Query".

WhereSQL::Query:: LogicalExpression

An expression for the WHERE clause.

XMLCharacter

Creates XML from the tree or recreates the tree from the XML.

Methods

Execute Method

Execute the current statement using the current or passed connection. Optionally providing argument values as an object or as XML.

GenerateNativeSyntax Method

Generate a native SQL statement using the selected syntax associated with the current or passed connection.

Parse Method

Parse the SQLStatement passed (or the value previously set into the SQLStatement property).

Reset Method

Reset the query as if it had just been created.

Validate Method

Execute the current statement using the current or passed connection.

See Also