SQL::Statement Object


The SQL::Statement object encapsulates the parsing and properties of a SQL SELECT, INSERT, UPDATE, or DELETE statement. as a result, it's properties will change depending on the last successfully processed SQL statement. Look at the related SQL::Query, SQL::InsertStatement, SQL::UpdateStatement, or SQL::DeleteStatement objects for available properties in each of these cases.


The following script inserts a new record.

dim conn as SQL::Connection
dim stat as SQL::Statement
dim qry as SQL::Query
dim rs as SQL::ResultSet
dim cs as SQL::CallResult
dim connString as C
dim sql_insert as C
dim sql_query as C

Next, define the connection string and the SQL INSERT statement. Note the syntax of the command. The fields that will receive data and the corresponding values are in two comma delimited sets.

connString = "{A5API='Access', FileName='c:\program files\a5v7\mdbfiles\alphasports.mdb'}"sql_insert = "insert into customer (firstname, lastname, bill_city, bill_postal_code, bill_state_region) values ('George', 'Jones', 'Arlington', '02000', 'VA')"

Open the connection and parse the insert command.

IF .not. conn.open(connString) THEN
IF .not. stat.parse(sql_insert) THEN
    ui_msg_box("Error", stat.callresult.text)

Insert the new record into the table.

cs = stat.CallResult
ui_msg_box("Call result", cs.Text)


Arguments SQL::Arguments

Read Only. Arguments for the current query.

CallResult SQL::CallResult

Read Only. Call results.

ColumnReferences ReferenceList of SQL::Query:: ColumnReference

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

Connection SQL::Connection

Read Write. Current open connection

ErrorColumn Numeric

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

ErrorText Character

Read Only. The text of the last parser error reported.

FunctionReferences ReferenceList of SQL::Query:: ValueExpression

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

ObjectDefinitions Character

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

ParseTree Character

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


Read Write. 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.

TokenTypeName Character

Read Only. For a SQL::Query object this property returns "Query", and so on. If no statement has been parsed, this property returns "Statement".

XML Character

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


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