User`s guide
hasdata
7-67
hasdata
Determine if cursor in DatabaseDatastore contains more data
Syntax
tf = hasdata(dbds)
Description
tf = hasdata(dbds) returns logical 1 (true) if additional data exists in the cursor
object of the DatabaseDatastore object dbds. Otherwise, it returns logical 0 (false).
For JDBC drivers, hasdata uses the driver to check if the cursor position is located at
the end of the data set. For the native ODBC interface, hasdata checks the Data field in
the cursor object for remaining data in the data set.
Examples
Determine the Presence of More Data in DatabaseDatastore
The default output data type of any datastore is a table. Set the database preference
for the data return format 'DataReturnFormat' to table for consistency across data
types.
setdbprefs('DataReturnFormat','table')
Create a database connection conn using the native ODBC interface with Windows
Authentication. This code assumes you are connecting to a Microsoft SQL Server
database with the data source named MS SQL Server Auth. MS SQL Server Auth
contains the table named productTable with 15 product records.
conn = database.ODBCConnection('MS SQL Server Auth','','');
Create a DatabaseDatastore object dbds using the database connection conn and
SQL query sqlquery. This SQL query retrieves all products from the product table
productTable ordered by product number.