SqlMoreResults Function | |
Copies another result set to a X# cursor if more result sets are available.
Namespace:
XSharp.VFP
Assembly:
XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax FUNCTION SqlMoreResults(
nStatementHandle AS LONG,
cCursorName AS USUAL,
aCountInfo AS USUAL
) AS LONG
public static int SqlMoreResults(
int nStatementHandle,
[DefaultParameterValueAttribute(0, 1)] Usual cCursorName,
[DefaultParameterValueAttribute(0, 1)] Usual aCountInfo
)
Request Example
View SourceParameters
- nStatementHandle
- Type: Long
Specifies the statement handle to the data source returned by SqlConnect( ).
- cCursorName
- Type: Usual
Specifies the name of the X# cursor to which the result set is sent. If you do not include a cursor name, X# uses the default name SQLRESULT.
For multiple result sets, new cursor names are derived by appending an incremented number to the name of the first cursor.
- aCountInfo
- Type: Usual
Return Value
Type:
Long
Numeric. SqlMoreResults( ) returns 0 if the SQL statement is still executing, returns 1 if it is finished executing, and returns 2 if no more data is found. In non-batch mode, SqlMoreResults( ) should be called after each successful SqlExec( ) call until SqlMoreResults( ) returns 2 (no more data found). The setting of the SqlSetProp( ) batch mode option determines whether SqlExec( ) executes a SQL statement in batch or non-batch mode.
SqlMoreResults( ) returns – 1 if a connection level error occurs, and returns – 2 if an environment level error occurs.
Remarks
SqlMoreResults( ) determines if more result sets are available from a SQL statement executed with SqlExec( ) in non-batch mode.
If more result sets are available, they are copied to a X# cursor, one set at a time.
SqlMoreResults( ) is one of the four functions that you can execute either synchronously or asynchronously.
The asynchronous setting of SqlSetProp( ) determines if these functions execute synchronously or asynchronously.
In asynchronous mode, you must call SqlMoreResults( ) repeatedly until it returns a value other than 0 (still executing).
Column | Array contents | Data type | Description |
---|
Alias | 0 | Character |
Indicates that SQL command did not return any results. Either no records were returned or the SQL command failed before results could be returned.
(final SqlMoreResults call) or execution failed before any result could be processed. Can be only on the first row.
Count column for the row contains value -1.
|
| Non-empty uppercase string | Character |
Alias of the cursor – target for the record fetch operation. The Count column for the row contains the number of fetched records or -1 if fetch failed.
If Count is -1, cursor may not have been created. During asynchronous execution, the fetch process for a cursor can be split between multiple
SqlMoreResults or SqlExec calls; each call returns its own fetch count for the cursor.
|
| Character | Empty String | Indicates that the SQL command (Insert, UPDATE, or DELETE) did not return a result set. |
Count | Number of affected or fetched records. | Integer | Indicates the number of affected records as returned by the ODBC SQLRowCount function. Returns -1 if the number of records is unavailable. |
Examples 1= SqlSetProp(gnHandle, 'BatchMode', .F.)
2= SqlExec(gnHandle, 'Select * From authors;
3Select * From titles')
4= SqlMoreRes(gnHandle)
5= SqlMoreRes(gnHandle)
See Also