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
Property | Type | Description |
---|---|---|
_ | 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. |
connection | odbc1connection | This is the ODBC connection with which this statement is associated. |
statement | string |
This contains the prepared SQL statement that was passed to the
createstatement() method of the
odb1connection object when this object was created.
|
type | type | 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
,
odbc1error columnnumber
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
columnnumber | .nul | integer | The column number for which a description is desired, based on the position of the column in the statement. |
error | .nul | odbc1error |
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
,
odbc1error parameters
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
parameters | .nul | array |
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 | .nul | odbc1error |
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
,
odbc1error results
)
error
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
results | .nul | array | 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 | .nul | odbc1error |
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
Parameter | Default value | Type name | Description |
---|---|---|---|
error | .nul | odbc1error |
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 .
|