SIMPOL Documentation

odbc1statement

Description

Creates a new odbc1statement object. This object is used for to hold the SQL statement prior to its execution. It's execute() method is used to actually execute the prepared statement on the ODBC data source.

Type Tags

None

Object Value

Objects of type odbc1statement have no value, and it is an error to try to get or set this value.

Properties

PropertyTypeDescription
_type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided.
__type(*) This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property.
connectionodbc1connection This is the ODBC connection with which this statement is associated.
statementstring This contains the prepared SQL statement that was passed to the createstatement() method of the odb1connection object when this object was created.
typetype Specifies the odbc1statement type object.

Methods

describecolumn()

Description

Retrieves an odbc1columndescription object that describes the column corresponding to the integer index value passed. If an error occurs, the error object will be filled out accordingly, and a .nul object will be returned. The column number is based on the position of the column in the statement.

Prototype

odbc1statementvar.describecolumn ( integer columnnumber, odbc1error error )

Parameters
ParameterDefault valueType nameDescription
columnnumber.nulinteger The column number for which a description is desired, based on the position of the column in the statement.
error.nulodbc1error Specifies an object that is used to output any error information generated during the execution of the method. This parameter must be an object, not an integer value. If error is not specified or is .nul then any error that occurs during object creation will halt the program. If an error object is specified and an error occurs during execution then the error code is output into that object and the method returns .nul.

execute()

Description

Executes a perviously prepared SQL statement. If it fails, the error object will be filled in.

Prototype

odbc1statementvar.execute ( array parameters, odbc1error error )

Parameters
ParameterDefault valueType nameDescription
parameters.nularray Specifies an array that contains parameters for replacement into the SQL statement. The placeholder character in the SQL statement is the question mark (?). The placeholders will be replaced by the values in the array, beginning with the subscript 1, and continuing in sequential order until the placeholders have all been replaced. If the array does not contain a value for a parameter, then it will receive the value .nul.
error.nulodbc1error Specifies an object that is used to output any error information generated during the execution of the method. This parameter must be an object, not an integer value. If error is not specified or is .nul then any error that occurs during object creation will halt the program. If an error object is specified and an error occurs during execution then the error code is output into that object and the method returns .nul.

fetch()

Description

Retrieves a row of results for a statement that has been executed. If there are no further results for the statement, then the SIMPOL error value 64 (end of data) will be returned in the appropriate property of the odbc1error object. The results are retrieved into the array passed. It is a good idea to create a new array for each row, since empty values may not be assigned as such to the array and in a loop might not overwrite any previous values, potentially giving faulty results. The column description will tell what the column name is and also the data type in SQL as well as that in SIMPOL.

Prototype

odbc1statementvar.fetch ( array results, odbc1error error )

Parameters
ParameterDefault valueType nameDescription
results.nularray The array object that will be used to return the row of results from the executed SQL statement. This must be a pre-initialized array object.
error.nulodbc1error Specifies an object that is used to output any error information generated during the execution of the method. This parameter must be an object, not an integer value. If error is not specified or is .nul then any error that occurs during object creation will halt the program. If an error object is specified and an error occurs during execution then the error code is output into that object and the method returns .nul.

getcolumncount()

Description

Retrieves the number of columns that are returned from the SQL statement that has been executed. Check the error object before using the return value!

Prototype

odbc1statementvar.getcolumncount ( odbc1error error )

Parameters
ParameterDefault valueType nameDescription
error.nulodbc1error Specifies an object that is used to output any error information generated during the execution of the method. This parameter must be an object, not an integer value. If error is not specified or is .nul then any error that occurs during object creation will halt the program. If an error object is specified and an error occurs during execution then the error code is output into that object and the method returns .nul.