caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Core Library
File Library
Servlet Library
Database Library
XML Library

DBPool
ResultSet
 ResultSet

java.sql.ResultSet properties
next() Advances the ResultSet to the next result. It returns false at the end of the data.
close() Closes the ResultSet.
wasNull() True if the last value read was null.
get(index) Returns a JavaScript object of the column given in the index.
getString(index) Return a string value from the column.
getBoolean(index) Return a boolean value from the column.
getInt(index) Returns an integer value from the column.
getDouble(index) Return a double value from the column.
getDate(index) Return a date value from the column.
getTime(index) Return a time value from the column.
getAsciiStream(index) Return an InputStream from the column.
getUnicodeStream(index) Return an InputStream from the column.
getBinaryStream(index) Return an InputStream from the column.
toObject([object]) Reads the entire result set into the JavaScript object.

java.sql.ResultSet properties

next()

Advances the ResultSet to the next result. It returns false at the end of the data.

close()

Closes the ResultSet.

wasNull()

True if the last value read was null.

get(index)

Returns a JavaScript object of the column given in the index. This is the JavaScript equivalent of getObject(index)

SQL type JavaScript type
BIT boolean
TINYINT number
SMALLINT number
INTEGER number
FLOAT number
REAL number
DOUBLE number
CHAR string
VARCHAR string
NULL null
BIGINT string
NUMERIC string
DECIMAL string
LONGVARCHAR InputStream
DATE date
TIME date
TIMESTAMP date
BINARY wrapped byte array
VARBINARY wrapped byte array
LONGVARBINARY InputStream

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

get() using numeric index
rs = statement.executeQuery("select NAME, PRICE from ITEMS");

while (rs.next()) {
  writeln(rs.get(1) + " " + rs.get(2));
}
Cappuccino 1.25
Mocha 1.90
Latte 1.75
Coffee 0.25
get() using string index
rs = statement.executeQuery("select NAME, PRICE from ITEMS");

while (rs.next()) {
  writeln(rs.get("name") + " " + rs.get("price"));
}
Cappuccino 1.25
Mocha 1.90
Latte 1.75
Coffee 0.25

getString(index)

Return a string value from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getBoolean(index)

Return a boolean value from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getInt(index)

Returns an integer value from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getDouble(index)

Return a double value from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getDate(index)

Return a date value from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getTime(index)

Return a time value from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getAsciiStream(index)

Return an InputStream from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getUnicodeStream(index)

Return an InputStream from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

getBinaryStream(index)

Return an InputStream from the column.

If index is a number, it returns the data for the column number, otherwise it returns the data for the named column.

toObject([object])

Reads the entire result set into the JavaScript object. If no arguments are given, create a new object.

rs = statement.executeQuery("select NAME, PRICE from ITEMS");

while (rs.next()) {
  obj = rs.toObject();

  writeln(obj.name + " " + obj.price);
}

DBPool   XML Library
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 31 Mar 2000 18:55:13 -0800 (PST)