A table of data representing a database result set, which is usually generated
by executing a statement that queries the database.
A JDBCResultSet concept maintains a cursor pointing to its current row of data.
Initially the cursor is positioned before the first row.
The next method moves the cursor to the next row, and because it returns false
when there are no more rows in the JDBCResultSet concept, it can be used in a
while loop to iterate through the result set.
A default JDBCResultSet concept is not updatable and has a cursor that moves forward only.
Thus, it is possible to iterate through it only once and only from the first row to the
last row. New methods in the JDBC 2.0 API make it possible to produce JDBCResultSet concepts
that are scrollable and/or updatable.
The JDBCResultSet concept provides getXXX methods for retrieving column values from the current row.
Values can be retrieved using either the index number of the column or the name of the column.
In general, using the column index will be more efficient. Columns are numbered from 1.
For maximum portability, result set columns within each row should be read in left-to-right order,
and each column should be read only once.
For the getXXX methods, a JDBC driver attempts to convert the underlying data to the MN8 type specified in the XXX part of the getXXX method and returns a suitable MN8 value.
Column names used as input to getXXX methods are case insensitive. When a getXXX method is called
with a column name and several columns have the same name, the value of the first matching column
will be returned. The column name option is designed to be used when column names are used in the
SQL query that generates the result set. For columns that are NOT explicitly named in the query,
it is best to use column numbers. If column names are used, there is no way for the programmer to
guarantee that they actually refer to the intended columns.
A set of updateXXX methods were added to this interface in the JDBC 2.0 API
(JavaTM 2 SDK, Standard Edition, version 1.2).
The comments regarding parameters to the getXXX methods also apply to parameters
to the updateXXX methods.
The updateXXX methods may be used in two ways:
to update a column value in the current row.
In a scrollable JDBCResultSet concept, the cursor can be moved backwards and forwards,
to an absolute position, or to a position relative to the current row.
to insert column values into the insert row.
An updatable JDBCResultSet concept has a special row associated with it that serves as a
staging area for building a row to be inserted.
A JDBCResultSet concept is automatically closed when the JDBCStatement concept that
generated it is closed, re-executed, or used to retrieve the next result from a
sequence of multiple results.
Establish the database connection.
$param typeof Map
$param.add("className", "org.postgresql.Driver")
$param.add("url", "jdbc:postgresql:testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
Create the JDBCStatement for sending SQL statements to the database.
$stmt = $con.createStatement
Show contents of of 'chartb' table from current database.
print "\nCharacter Data Type"
print "---------------------------------------------------------------------------"
print "| Char | Char(10) | TEXT | VARCHAR(20) |"
print "---------------------------------------------------------------------------"
$rs = $stmt.executeQuery("SELECT * FROM chartb")
while $rs.next do [
$result typeOf String
$result += "|" + $rs.getString("charf") + " |"
$x = $rs.getString("charvf").toTXT
$i = $x.getLength
do [
$result += " "
$i++ ] while ( $i < 12 )
$result += $x + "|"
$x = $rs.getString("textf").toTXT
$i = $x.getLength
do [
$result += " "
$i++ ] while ( $i < 30 )
$result += $x + "|"
$x = $rs.getString("varcharf").toTXT
$i = $x.getLength
do [
$result += " "
$i++ ] while ( $i < 22 )
$result += $x + "|" print $result ]
$rs.close
print "---------------------------------------------------------------------------"
Verify if 'textf' named field form table 'chartb' was NULL.
$rs = $stmt.executeQuery("SELECT * FROM chartb")
while $rs.next do [
$rs.getString("textf")
print "Field 'textf': " + $rs.wasNull]
$rs.close
Find 'textf' named field in 'chartb' table and show the column number.
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Column ID for 'textf' column is : " + $rs.findColumn("textf")
$rs.close
Test the: beforeFirst, isBeforeFirst, afertLast, isAfterLast methods
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Move cursor after last record."
$rs.afterLast
print "Is after last record : " + $rs.isAfterLast
print "Move cursor before first record."
$rs.beforeFirst
print "Is before first record : " + $rs.isBeforeFirst
$rs.close
Move the cursor in resultSet absolute and relative
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Move to second record :" + $rs.absolute(2) + " 'BCD'=" + $rs.getString("char5f")
print "Move to first record :" + $rs.relative(-1) + " 'ABC'=" + $rs.getString("char5f")
$rs.close
Logical | absolute (Integer $row) |
| afterLast |
Series | availableDirections |
| beforeFirst |
| cancelRowUpdates |
| close |
| deleteRow |
Integer | findColumn (String $columnName) |
BigDecimal | getBigDecimal (Integer $columnIndex) |
BigDecimal | getBigDecimal (String $columnName) |
String | getConcurrency |
String | getCursorName |
String | getFetchDirection |
Integer | getFetchSize |
Integer | getInteger (Integer $columnIndex) |
Integer | getInteger (String $columnName) |
Logical | getLogical (Integer $columnIndex) |
Logical | getLogical (String $columnName) |
Real | getReal (Integer $columnIndex) |
Real | getReal (String $columnName) |
Integer | getRow |
JDBCStatement | getStatement |
String | getString (Integer $columnIndex) |
String | getString (String $columnName) |
Integer | getTimestamp (String $columnName) |
Integer | getTimestamp (Integer $columnIndex) |
String | getType |
| insertRow |
Logical | isAfterLast |
Logical | isBeforeFirst |
Logical | isFirst |
Logical | isLast |
| moveToCurrentRow |
| moveToInsertRow |
Logical | next |
Logical | previous |
| refreshRow |
Logical | relative (Integer $rows) |
Logical | rowDeleted |
Logical | rowInserted |
Logical | rowUpdated |
| setFetchDirection (String $direction) |
| setFetchSize (Integer $rows) |
Logical | setFirst |
Logical | setLast |
| updateBigDecimal (Integer $columnIndex, BigDecimal $value) |
| updateBigDecimal (String $columnName, BigDecimal $value) |
| updateInteger (String $columnName, Integer $value) |
| updateInteger (Integer $columnIndex, Integer $value) |
| updateLogical (String $columnName, Logical $value) |
| updateLogical (Integer $columnIndex, Logical $value) |
| updateNull (String $columnName) |
| updateNull (Integer $columnIndex) |
| updateReal (Integer $columnIndex, Real $value) |
| updateReal (String $columnName, Real $value) |
| updateRow |
| updateString (Integer $columnIndex, String $value) |
| updateString (String $columnName, String $value) |
| updateTimestamp (String $columnName, Integer $value) |
| updateTimestamp (Integer $columnIndex, Integer $value) |
Logical | wasNull |
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs, the row is 0, or the result set type is FORWARD
. |
Moves the cursor to the given row number in this JDBCResultSet concept.
If the row number is positive, the cursor moves to the given row number
with respect to the beginning of the result set.
The first row is row 1, the second is row 2, and so on.
If the given row number is negative, the cursor moves to an absolute row
position with respect to the end of the result set.
For example, calling the method absolute(-1) positions the cursor on the last row;
calling the method absolute(-2) moves the cursor to the next-to-last row, and so on.
Note:
Calling absolute(1) is the same as calling first().
Calling absolute(-1) is the same as calling last().
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Current cursor position: " + $rs.getRow
$rs.absolute(2)
print "New cursor position: " + $rs.getRow
$rs.close
$stmt.close
$con.close
-- the result is --
Current cursor position: 0
New cursor position: 2
Exceptions: |
SQLException :
(Error) | if a database access error occurs or the result set type is FORWARD
. |
Moves the cursor to the end of this JDBCResultSet concept,
just after the last row. This method has no effect if the
result set contains no rows.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.afterLast
print "Is afterLast: " + $rs.isAfterLast
$rs.close
$stmt.close
$con.close
-- the result is --
Is afterLast: true
Returns the fetch directions for JDBCResultSet concepts.
Available directions are: FORWARD
, REVERSE
, and UNKNOWN
.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print $rs.availableDirections
$rs.close
$stmt.close
$con.close
-- the result is --
FORWARD
REVERSE
UNKNOWN
Exceptions: |
SQLException :
(Error) | if a database access error occurs or the result set type is FORWARD
. |
Moves the cursor to the front of this JDBCResultSet concept,
just before the first row.
This method has no effect if the result set contains no rows.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.beforeFirst
print "Is beforeFirst: " + $rs.isBeforeFirst
$rs.close
$stmt.close
$con.close
-- the result is --
Is beforeFirst: true
Exceptions: |
SQLException :
(Error) | if a database access error occurs or if this method is called when the cursor is on the insert row. |
Cancels the updates made to the current row in this JDBCResultSet concept.
This method may be called after calling an updateXXX method(s) and before
calling the method updateRow to roll back the updates made to a row.
If no updates have been made or updateRow has already been called,
this method has no effect.
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Releases this JDBCResultSet concepts database and JDBC resources immediately
instead of waiting for this to happen when it is automatically closed.
Note:
A JDBCResultSet concept is automatically closed by the JDBCStatement
concept that generated it when that JDBCStatement concept is closed, re-executed,
or is used to retrieve the next result from a sequence of multiple results.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
#..........
# Works with ResultSet concept
#..............
$rs.close
$stmt.close
$con.close
-- the result is --
Exceptions: |
SQLException :
(Error) | if a database access error occurs or if this method is called when the cursor is on the insert row. |
Deletes the current row from this JDBCResultSet concept and from the
underlying database.
This method cannot be called when the cursor is on the insert row.
Parameters: |
$columnName : | the name of the column. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Maps the given JDBCResultSet column name to its JDBCResultSet column index.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "ColumnID is: " + $rs.findColumn("textf")
$rs.close
$stmt.close
$con.close
-- the result is --
ColumnID is: 4
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this JDBCResultSet concept
as a BigDecimal concept.
Parameters: |
$columnName : | the column name. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this JDBCResultSet concept
as a BigDecimal concept.
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Returns the concurrency mode of this JDBCResultSet concept. The used concurrency is
determined by the JDBCStatement concept that created the result set.
The concurrency mode can be: READ_ONLY
or UPDATABLE
.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Concurrency: " + $rs.getConcurrency
$rs.close
$stmt.close
$con.close
-- the result is --
Concurrency: READ_ONLY
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the name of the SQL cursor used by this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.postgresql.Driver")
$param.add("url", "jdbc:postgresql:testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$stmt.setCursorName("SQLCursor")
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Cursor name: " + $rs.getCursorName
$rs.close
$stmt.close
$con.close
-- the result is --
Cursor name: SQLCursor
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Returns the fetch direction for this JDBCResultSet concept.
The fetch direction can be: FORWARD
, REVERSE
or UNKNOWN
.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Direction: " + $rs.getFetchDirection
$rs.close
$stmt.close
$con.close
-- the result is --
Direction: FORWARD
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Returns the fetch size for this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Default fetch size: " + $rs.getFetchSize
$rs.close
$stmt.close
$con.close
-- the result is --
Default fetch size: 0
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as an Integer concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM numerictb")
while ( $rs.next ) do [
print "First numeric field: " + $rs.getInteger(1)
]
$rs.close
$stmt.close
$con.close
-- the result is --
First numeric field: 100
First numeric field: 127
Parameters: |
$columnName : | the SQL name of the column. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as an Integer concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM numerictb")
while ( $rs.next ) do [
print "'integerf' named field: " + $rs.getInteger("integerf")
]
$rs.close
$stmt.close
$con.close
-- the result is --
'integer' named field: 1234324
'integer' named field: 1989896
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a Logical concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:psotgresql:testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM boolantb")
while ( $rs.next ) do [
print "First logical field: " + $rs.getLogical(1)
]
$rs.close
$stmt.close
$con.close
-- the result is --
First logical field: true
First locical field: false
Parameters: |
$columnName : | the SQL name of the column. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a Logical concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:psotgresql:testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM boolantb")
while ( $rs.next ) do [
print "'booelanf' named field: " + $rs.getLogical("booelanf")
]
$rs.close
$stmt.close
$con.close
-- the result is --
'booleanf' named field: true
'booleanf' named field: false
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a Real concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM numerictb")
while ( $rs.next ) do [
print "A real field: " + $rs.getReal(7)
]
$rs.close
$stmt.close
$con.close
-- the result is --
A real field: 3.849e+13
A real field: 4.56461e+15
Parameters: |
$columnName : | the SQL name of the column. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a Real concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM numerictb")
while ( $rs.next ) do [
print "'realf' named field: " + $rs.getReal("realf")
]
$rs.close
$stmt.close
$con.close
-- the result is --
'realf' named field: 3.84900458470083e+18
'realf' named field: 4.54564612354526e+20
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Retrieves the current row number. The first row is number 1,
the second number 2, and so on.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM numerictb")
print "Current row: " + $rs.getRow
$rs.close
$stmt.close
$con.close
-- the result is --
Current row: 0
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Returns the JDBCStatement concept that produced this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM numerictb")
print $rs.getStatement.getConceptType
$rs.close
$stmt.close
$con.close
-- the result is --
JDBCStatement
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a String concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
while ( $rs.next ) do [
print "A string field: " + $rs.getString(3)
]
$rs.close
$stmt.close
$con.close
-- the result is --
A string field: Small Text1
A string field: Small Text2
A string field: Small Text3
Parameters: |
$columnName : | the SQL name of the column. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a String concept in the mn8 programming language.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
while ( $rs.next ) do [
print "'textf' named field: " + $rs.getString("textf")
]
$rs.close
$stmt.close
$con.close
-- the result is --
'textf' named field: Text1
'textf' named field: Text2
'textf' named field: Text3
Parameters: |
$columnName : | the SQL name of the column. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a Integer concept, that contains
measured time in milliseconds, between the specified time and midnight,
January 1, 1970 UTC.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM datetimetb")
while ( $rs.next ) do [
print "'datef' named field: " + Date.create( $rs.getTimestamp("datef") ).getDate("yyyy-MM-dd")
]
$rs.close
$stmt.close
$con.close
-- the result is --
'datef' named field: 1975-01-02
'datef' named field: 1985-12-25
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Gets the value of the designated column in the current row of this
JDBCResultSet concept as a Integer concept, that contains
measured time in milliseconds, between the specified time and midnight,
January 1, 1970 UTC.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM datetimetb")
while ( $rs.next ) do [
print "A datetime field: " + Date.create( $rs.getTimestamp(1) ).getDate("yyyy-MM-dd HH:mm:ss")
]
$rs.close
$stmt.close
$con.close
-- the result is --
A datetime field: 2002-06-25 12:30:25
A datetime field: 2001-07-25 23:30:25
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Returns the type of this JDBCResultSet concept.
The type is determined by the JDBCStatement concept
that created the result set.
The type can be: FORWARD
, INSENSITIVE
, or SENSITIVE
.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM datetimetb")
print "Type: " + $rs.getType
$rs.close
$stmt.close
$con.close
-- the result is --
Type: INSENSITIVE
Exceptions: |
SQLException :
(Error) |
if a database access error occurs; if this method is called when the cursor
is not on the insert row or if not all of non-nullable columns in the insert
row have been given a value
|
Inserts the contents of the insert row into this JDBCResultSet concept
and into the database.
The cursor must be on the insert row when this method is called.
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Indicates whether the cursor is after the last row in
this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.afterLast
print "Is afterLast: " + $rs.isAfterLast
$rs.close
$stmt.close
$con.close
-- the result is --
Is afterLast: true
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Indicates whether the cursor is before the first row in
this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.afterLast
print "Is beforefirst: " + $rs.isBeforeFirst
$rs.close
$stmt.close
$con.close
-- the result is --
Is beforeFirst: true
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Indicates whether the cursor is on the first row of
this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.setFirst
print "Is first: " + $rs.isFirst
$rs.close
$stmt.close
$con.close
-- the result is --
Is first: true
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Indicates whether the cursor is on the last row of
this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.setLast
print "Is last: " + $rs.isLast
$rs.close
$stmt.close
$con.close
-- the result is --
Is last: true
Exceptions: |
SQLException :
(Error) | if a database access error occurs or the result set is not updatable. |
Moves the cursor to the remembered cursor position, usually the current row.
This method has no effect if the cursor is not on the insert row.
Exceptions: |
SQLException :
(Error) | if a database access error occurs or the result set is not updatable. |
Moves the cursor to the insert row. The current cursor position is remembered
while the cursor is positioned on the insert row.
The insert row is a special row associated with an updatable result set.
It is essentially a buffer where a new row may be constructed by calling the updateXXX methods prior to inserting the row into the result set.
Only the updateXXX, getXXX, and insertRow methods may be called when the cursor
is on the insert row.
All of the columns in a result set must be given a value each time this method
is called before calling insertRow. An updateXXX method must be called before
a getXXX method can be called on a column value.
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Moves the cursor down one row from its current position.
A JDBCResultSet cursor is initially positioned before the first row;
the first call to the method next makes the first row the current row;
the second call makes the second row the current row, and so on.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
while ( $rs.next ) do [
print "Row: " + $rs.getRow
]
$rs.close
$stmt.close
$con.close
-- the result is --
Row: 1
Row: 2
Row: 3
Exceptions: |
SQLException :
(Error) | if a database access error occurs or the result set type is FORWARD
. |
Moves the cursor to the previous row in this JDBCResultSet concept.
Note:
Calling the method previous() is not the same as calling
the method relative(-1) because it makes sense to call previous()
when there is no current row.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.afterLast
while ( $rs.previous ) do [
print "Row: " + $rs.getRow
]
$rs.close
$stmt.close
$con.close
-- the result is --
Row: 3
Row: 2
Row: 1
Exceptions: |
SQLException :
(Error) |
if a database access error occurs or if this method
is called when the cursor is on the insert row.
|
Refreshes the current row with its most recent value in the database.
This method cannot be called when the cursor is on the insert row.
If refreshRow is called after calling an updateXXX method, but before
calling the method updateRow, then the updates made to the row are lost.
Calling the method refreshRow frequently will likely slow performance.
Exceptions: |
SQLException :
(Error) | if a database access error occurs, the row is 0, or the result set type is FORWARD
. |
Moves the cursor a relative number of rows, either positive or negative.
Attempting to move beyond the first/last row in the result set positions
the cursor before/after the the first/last row.
Calling relative(0) is valid, but does not change the cursor position.
Note:
Calling the method relative(1) is different from calling the
method next() because is makes sense to call next() when there is no current row,
for example, when the cursor is positioned before the first row or after the
last row of the result set.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
print "Current cursor position: " + $rs.getRow
$rs.realative( -1 )
print "New cursor position: " + $rs.getRow
$rs.close
$stmt.close
$con.close
-- the result is --
Current cursor position: 0
New cursor position: 3
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Indicates whether a row has been deleted.
A deleted row may leave a visible 'hole' in a result set.
This method can be used to detect holes in a result set.
The value returned depends on whether or not this
JDBCResultSet concept can detect deletions.
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Indicates whether the current row has had an insertion.
The value returned depends on whether or not this
JDBCResultSet concept can detect visible inserts.
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Indicates whether the current row has been updated.
The value returned depends on whether or not the
result set can detect updates.
Parameters: |
$direction : | the initial direction for processing rows. |
|
Exceptions: |
SQLException :
(Error) |
if a database access error occurs or the result set type is FORWARD
and the fetch direction is not FORWARD
|
Gives a hint as to the direction in which the rows in this JDBCResultSet
concept will be processed. The initial value is determined by the
JDBCStatement concept that produced this JDBCResultSet concept.
The fetch direction may be changed at any time.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.setFetchDirection("FORWARD")
print "Direction: " + $rs.getFetchDirection
$rs.close
$stmt.close
$con.close
-- the result is --
Direction: FORWARD
Parameters: |
$rows : | the number of rows to fetch. |
|
Exceptions: |
SQLException :
(Error) |
if a database access error occurs or the condition
0 <= rows <= this.getMaxRows() is not satisfied
|
Gives the JDBC driver a hint as to the number of rows that should be fetched
from the database when more rows are needed for this JDBCResultSet concept.
If the fetch size specified is zero, the JDBC driver ignores the value
and is free to make its own best guess as to what the fetch size should be.
The default value is set by the JDBCStatement concept that created the result set.
The fetch size may be changed at any time.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.setFetchSize(10)
print "FetchSize: " + $rs.getFetchSize
$rs.close
$stmt.close
$con.close
-- the result is --
FetchSize: 10
Exceptions: |
SQLException :
(Error) |
if a database access error occurs or the result set type is FORWARD
. |
Moves the cursor to the first row in this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.setFirst
print "Is first: " + $rs.isFirst
$rs.close
$stmt.close
$con.close
-- the result is --
Is first: true
Exceptions: |
SQLException :
(Error) |
if a database access error occurs or the result set type is FORWARD
. |
Moves the cursor to the last row in this JDBCResultSet concept.
$param typeof Map
$param.add("className", "org.gjt.mm.mysql.Driver")
$param.add("url", "jdbc:mysql:/localhost/testdb")
$param.add("user", "root")
$param.add("passwd", "")
$con = JDBCClient.getConnection( $param )
$stmt = $con.createStatement
$rs = $stmt.executeQuery("SELECT * FROM chartb")
$rs.setLast
print "Is last: " + $rs.isLast
$rs.close
$stmt.close
$con.close
-- the result is --
Is last: true
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a BigDecimal concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnName : | the name of the column. |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a BigDecimal concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnName : | the name of the column. |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Integer concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Integer concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnName : | the name of the column. |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Logical concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Logical concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnName : | the name of the column. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a null value.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a null value.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Real concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnName : | the name of the column. |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Real concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Exceptions: |
SQLException :
(Error) | if a database access error occurs or if this method is called when the cursor is on the insert row. |
Updates the underlying database with the new contents of the current row
of this JDBCResultSet concept.
This method cannot be called when the cursor is on the insert row.
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a String concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnName : | the name of the column. |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a String concept.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnName : | the name of the column. |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Integer concept, that contains
measured time in milliseconds, between the specified time and midnight,
January 1, 1970 UTC.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Parameters: |
$columnIndex : | the first column is 1, the second is 2, ... |
$value : | the new column value. |
|
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Updates the designated column with a Integer concept, that contains
measured time in milliseconds, between the specified time and midnight,
January 1, 1970 UTC.
The updateXXX methods are used to update column values
in the current row or the insert row.
The updateXXX methods do not update the underlying database;
instead the updateRow or insertRow methods are called to
update the database.
Exceptions: |
SQLException :
(Error) | if a database access error occurs. |
Reports whether the last column read had a value of SQL NULL.
Note that you must first call one of the getXXX methods on a column
to try to read its value and then call the method wasNull
to see if the value read was SQL NULL.