Xbasic

SQL::Arguments Class

Description

Properties and methods in the Arguments Class.

Example

dim conn as SQL::Connection
dim sql as C
dim vCity as C
dim args as SQL::Arguments
vCity = ui_get_text("City", "Show Companies in what city?")
sql = "select lastname, firstname from customer where bill_city = :city Order By Company"
if .not. conn.open("::Name::AADemo-Northwind")
    ui_msg_box("Error", conn.CallResult.text)
    end
end if
if .not. args.Set("city", vCity)
    end
end if
if .not. conn.execute(sql, args)
    ui_msg_box("Error", conn.CallResult.text)
    end
end if
sql_resultset_preview(conn.resultset)

Getting a SQL::Argument from the Arguments array

Each argument is stored as a SQL::Argument object in the Arguments array. You can use array syntax to access arguments in the array on the SQL::Arguments object. For example:

dim args as SQL::Arguments
args.set("City","Boston")
args.set("State","MA")
args.set("Country","United States")

dim arg1 as SQL::Argument
arg1 = args[1]

? arg1
= Data = "Boston"
IsNull = .F.
Name = "city"
Usage = 0
XML = <SQLArgument>
	<Name>city</Name>
	<Data Type="C">Boston</Data>
	<IsNull Type="L">0</IsNull>
	<Usage>Input</Usage>
</SQLArgument>

See SQL::Argument for more information.

Properties

ArgumentsSQL::Argument

An ordered collection of SQL::Argument objects. Array syntax can be used to access individual arguments in the array. For example, args[1]. See SQL::Argument for more information.

CountNumeric

The number of arguments.

XMLCharacter

An XML string that contains the definition for all arguments.

Methods

Add Method

Add an argument to the collection or L Add(SQL::Argument Argument)

ArgumentNumber Method

Get the sequence number of the named argument. Returns -1 if not found.

Clear Method

Remove all arguments from the SQL::Arguments object.

Find Method

Find an argument in the SQL::Arguments object.

Remove Method

Remove an argument from the collection.

Set Method

Set the value and (optionally) the usage of an argument.

SetNull Method

Set a value to NULL and (optionally) the usage of the argument.

See Also