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

Mode R. Arguments for the current query.

CallResultSQL::CallResult

Mode R. Call results.

ColumnReferencesReferenceList of SQL::Query:: ColumnReference

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

Connection SQL::Connection

Mode RW. Current open connection

ErrorColumn N

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

ErrorText C

Mode R. The text of the last parser error reported.

FunctionReferences ReferenceList of SQL::Query:: ValueExpression

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

ObjectDefinitions C

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

ParseTree C

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

SelectTableReferencesReferenceList of SQL::Query:: SelectTableReference

Mode R. 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

Mode RW. 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.

Table SQL::Query:: SelectTableReference

Mode RW. The table to be inserted into.

TokenTypeName Character

Mode R. "Query".

Where SQL::Query:: LogicalExpression

Mode RW. An expression for the WHERE clause.

XMLCharacter

Mode RW. 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