Class Cursor

java.lang.Object
org.kissweb.database.Cursor
All Implemented Interfaces:
AutoCloseable

public class Cursor extends Object implements AutoCloseable
Instances of this class represent a row into a result set. If a single table is selected from, rows may be updated or deleted via these facilities.

It is important to understand that this class represents a Kiss Cursor and not a true database cursor! When queries occur, Kiss downloads all the records in the result set either in memory or a local disk file and then closes any database cursor. The advantage of this approach is that there is never a problem with multiple database cursors being open simultaneously or nested in code (which often causes database performance issues or interference). However, from the application's perspective, a Kiss Cursor works just like a database cursor and has all the same functionality.

A new cursor is created with the following code:

     Cursor cursor = cmd.query("select .....

where cmd is an instance of Command.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close the entire cursor.
    Read in all of the records and close the cursor.
    org.json.JSONArray
    This method does the same thing as fetchAll except that it return a JSON array representing all of the records.
    Read in a single record and close the read cursor (no more records can be read).
    org.json.JSONObject
    This method works exactly like fetchOne except that it return a JSON object representing the record.
    org.json.JSONObject
    fetchOneJSON(org.json.JSONObject obj)
    This method works like fetchOne except that it adds the record columns to an existing JSON object passed in.
    get(String cname)
    Get the value of a column as an Object.
    byte[]
    Return the byte[] value of the named column.
    getChar(String cname)
    Return the Character value of the named column.
    int
    Return the date in an int formatted as YYYYMMDD for the named column.
    Return the java.util.Date value of the named column.
    Return the java.util.Date value of the named column.
    long
    Return the date/time value as the number of milliseconds since 1970 UTC.
    Return the Double value of the named column.
    Return the Float value of the named column.
    getInt(String cname)
    Return the Integer value of the named column.
    getLong(String cname)
    Return the Long value of the named column.
    Returns the Record instance representing the current row.
    Return the Short value of the named column.
    Return the String value of the named column.
    Returns the name of the table associated with the select associated with this cursor.
    long
    getTime(String cname)
    Return the long value of the named column.
    boolean
    This method advances the row pointer and returns true if there is a next record.
    This method is used to advance the row pointer first and then return the (next) Record instance representing the next row.
    set(String name, Object val)
    Set the value of a column in the current record.
    setDateOnly(String name, int dat)
    Set the date portion of the Date only (no time info) value of a column in the record.
    setDateOnly(String name, Date val)
    Set the date portion of the Date only (no time info) value of a column in the record.
    setDateTime(String name, long val)
    Set the date and time value of a column in the record.
    setDateTime(String name, Date val)
    Set the date and time value of a column in the record.
    setTime(String name, long dat)
    Set the time value in milliseconds
    long
    Returns the number of records in the cursor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait