Xbasic

SQL DeleteStatement Object

Description

SQL DeleteStatement Object properties, methods, and examples.

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 del as SQL::DeleteStatement
dim qry as SQL::Query
dim rs as SQL::ResultSet
dim connString as C
dim sql_delete as C
dim sql_query as C

Assign values to the character variables.

connString = "{A5API='Access', FileName='c:\program files\a5v7\mdbfiles\alphasports.mdb'}"
sql_query = "select * from customer_copy order by lastname"

Note that the DELETE command uses the SubString()portability function as part of the WHERE clause.

sql_delete = "DELETE FROM Customer_copy WHERE substring(lastname,1,1) = 'A'"

Establish the connection.

IF .not. conn.open(connString) THEN
    end
END IF

Check the SQL DELETE statement.

IF .not. del.parse(sql_delete) THEN
    ui_msg_box("Error", del.callresult.text)
    end
END IF

Execute the SQL DELETE statement.

IF .not. del.execute(conn)
    ui_msg_box("Error", del.callresult.text)
    end
END IF

Now, look at the results.

qry.parse(sql_query)
qry.execute(conn)
rs = qry.resultset
a5_sqlresultsetpreview(rs)
conn.close()

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.

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