The DBResultSet class contains a list of resultset rows.
More...
The DBResultSet class contains a list of resultset rows.
You need an active DBConnection object to execute an SQL query which is used to create a DBResultSet.
- Note
- Important: Please consider the restrictions according the order of reading of the columns of the DBResultSet. Read the example!
The following data types for database columns will be supported:
SQL data type | access method |
SQL_INTEGER | getInt(), getString() |
SQL_SMALLINT | getInt(), getString() |
SQL_BIGINT | getInt(), getString() |
SQL_FLOAT | getFloat(), getInt(), getString() |
SQL_DECIMAL | getFloat(), getInt(), getString() |
SQL_NUMERIC | getFloat(), getInt(), getString() |
SQL_BIT | getBool(), getString() |
SQL_TIMESTAMP | getTimestamp(), getString() |
SQL_DATE | getDate(), getString() |
SQL_GUID | getString() |
SQL_VARCHAR | getString() |
SQL_CHAR | getString() |
all other types | getString() |
- Example:
if (myDB && myDB.getLastError() == null)
{
var myRS = myDB.executeQuery("SELECT Nachname, Vorname FROM Personal");
if (myRS)
{
while (myRS.next())
{
var fullName = myRS.getString(0) + ", " + myRS.getString(1);
util.out(fullName);
}
myRS.close()
}
else
util.out("Error in SELECT statement: " + myDB.getLastError());
myDB.close();
}
else
util.out("Error connection the database: " + myDB.getLastError())
- Since
- ELC 3.50 / otrisPORTAL 5.0
-
DOCUMENTS 5.0c HF1 (support for SQL_GUID)
- See also
- DBConnection
◆ close()
boolean DBResultSet::close |
( |
| ) |
|
Close the DBResultSet and free the server ressources.
- Note
- It is strongly recommanded to close each DBResultSet object you have created, since database connections and resultsets are so-called expensive ressources and should be used carefully.
- Returns
true
if successful, false
in case of any error
- Since
- ELC 3.50 / otrisPORTAL 5.0
- See also
- DBConnection.close()
◆ getBool()
boolean DBResultSet::getBool |
( |
int |
colNo | ) |
|
Read the indicated column of the current row of the DBResultSet as a boolean value.
- Parameters
-
colNo | integer value (zero based) indicating the desired column of the current row of the DBResultSet |
- Returns
- boolean value representing the indicated column of the current row
- Since
- ELC 3.50 / otrisPORTAL 5.0
◆ getColName()
String DBResultSet::getColName |
( |
int |
colNo | ) |
|
Function returns the name of a column.
- Parameters
-
colNo | integer value (zero based) indicating the desired column |
- Returns
- Column name as String
- Since
- DOCUMENTS 5.0
◆ getDate()
Date DBResultSet::getDate |
( |
int |
colNo | ) |
|
Read the indicated column of the current row of the DBResultSet as a Date object.
- Note
- The return value will be
null
if the content of the indicated column cannot be converted to a Date object.
- Parameters
-
colNo | integer value (zero based) indicating the desired column of the current row of the DBResultSet |
- Returns
- Date object representing the indicated column of the current row or
NULL
if is null-value
- Since
- ELC 3.50 / otrisPORTAL 5.0
- Note
- every value of a DBResultSet can only be read one time and in the correct order!
◆ getFloat()
float DBResultSet::getFloat |
( |
int |
colNo | ) |
|
Read the indicated column of the current row of the DBResultSet as a float value.
- Note
- The return value will be
NaN
if the content of the indicated column cannot be converted to a float value.
- Parameters
-
colNo | integer value (zero based) indicating the desired column of the current row of the DBResultSet |
- Returns
- float value representing the indicated column of the current row or
NULL
if is null-value
- Since
- ELC 3.50 / otrisPORTAL 5.0
- Note
- every value of a DBResultSet can only be read one time and in the correct order!
◆ getInt()
int DBResultSet::getInt |
( |
int |
colNo | ) |
|
Read the indicated column of the current row of the DBResultSet as an integer value.
- Note
- The return value will be
NaN
if the content of the indicated column cannot be converted to an integer value.
- Parameters
-
colNo | integer value (zero based) indicating the desired column of the current row of the DBResultSet |
- Returns
- integer value representing the indicated column of the current row or
NULL
if is null-value
- Since
- ELC 3.50 / otrisPORTAL 5.0
- Note
- every value of a DBResultSet can only be read one time and in the correct order!
◆ getLastError()
String DBResultSet::getLastError |
( |
| ) |
|
Function to get the description of the last error that occurred.
- Returns
- Text of the last error as String
- Since
- ELC 3.50 / otrisPORTAL 5.0
- See also
- DocFile.getLastError()
◆ getNumCols()
int DBResultSet::getNumCols |
( |
| ) |
|
Function returns the amount of columns of the DBResultSet.
- Returns
- Column count as int
- Since
- DOCUMENTS 5.0
◆ getString()
String DBResultSet::getString |
( |
int |
colNo | ) |
|
Read the indicated column of the current row of the DBResultSet as a String.
- Parameters
-
colNo | integer value (zero based) indicating the desired column of the current row of the DBResultSet |
- Returns
- String representing the indicated column of the current row or
NULL
if is null-value
- Since
- ELC 3.50 / otrisPORTAL 5.0
- Note
- x64/UTF-8 DOCUMENTS version: since DOCUMENTS 4.0a HF2 the method transcode the fetched data to UTF-8
-
every value of a DBResultSet can only be read one time and in the correct order!
◆ getTimestamp()
Date DBResultSet::getTimestamp |
( |
int |
colNo | ) |
|
Read the indicated column of the current row of the DBResultSet as a Date object including the time.
- Note
- The return value will be
null
if the content of the indicated column cannot be converted to a Date object.
- Parameters
-
colNo | integer value (zero based) indicating the desired column of the current row of the DBResultSet |
- Returns
- Date object (including time) representing the indicated column of the current row or
NULL
if is null-value
- Since
- ELC 3.50 / otrisPORTAL 5.0
- Note
- every value of a DBResultSet can only be read one time and in the correct order!
◆ getUCString()
String DBResultSet::getUCString |
( |
int |
colNo | ) |
|
Read the indicated column of the current row of the DBResultSet on a x64/UTF-8 DOCUMENTS as a String.
- Parameters
-
colNo | integer value (zero based) indicating the desired column of the current row of the DBResultSet |
- Returns
- String representing the indicated column of the current row or
NULL
if is null-value
- Since
- DOCUMENTS 4.0
- Deprecated:
- since DOCUMENTS 4.0a HF2 use DBResultSet.getString() instead
- Note
- every value of a DBResultSet can only be read one time and in the correct order!
◆ next()
boolean DBResultSet::next |
( |
| ) |
|
Move the resultset pointer to the next row of the DBResultSet.
The method must be called at least once after retrieving a DBResultSet, because the newly created object does not point to the first result row but to BOF (beginning of file).
- Returns
true
if the DBResultSet now points to the next row, false
if there is no further result row
- Since
- ELC 3.50 / otrisPORTAL 5.0
- Note
- every value of a DBResultSet can only be read one time and in the correct order!