contents   index   previous   next



Database cursor()

syntax:

database.cursor(sqlstatement[,mode])

where:

sqlstatement - String containing a SQL SELECT statement supported by the database server.

 

mode - optional parameter indicating whether the cursor can be modified.

 

return:

object - a new Cursor object, representing the results of the specified SQL statement.

 

description:

This method creates a Cursor object that contains the rows returned by the specified SQL SELECT statement in the sqlstatement parameter. If the SELECT statement does not return any rows, the resulting Cursor object also has no rows.

 

The optional mode parameter specifies how the Cursor object will access and modify records. The options for this field are:

 

Database.snapshot - uses SQLExtendedFetch, static cursor

 

Database.dynaset - uses SQLExtendedFetch, keyset driven cursor

 

Database.forwardOnly - uses SQLFetch

 

Database.dynamic - uses SQLExtendedFetch, dynamic cursor

 

If no value is specified in the mode parameter, the cursor is created Database.snapshot.

 

If an updateable Cursor object is desired, the virtual table returned by the sqlstatement parameter must be updateable. For example, the SELECT statement passed as the sqlstatement parameter cannot contain a GROUP BY clause. In addition, the query usually must retrieve key values from a table. For more information on constructing updateable queries, consult your database vendor's documentation.

 

see:

#link <sedbc>, Cursor object

 

example:

// This example creates the updateable cursor 'custs'

// and

// returns the columns 'ID', 'CUST_NAME',

// and 'CITY' from the

// customer table:

custs = db.cursor("select id, cust_name,

                  city from customer",

                  Database.dynaset);

 


Database disconnect()