use of com.dexels.navajo.adapter.sqlmap.ResultSetIterator in project navajo by Dexels.
the class SQLMap method getStreamingResultSet.
@Override
public Iterator<ResultSetMap> getStreamingResultSet() throws UserException {
requestCount++;
ResultSet rs = null;
long start = 0;
if (debug || timeAlert > 0) {
start = System.currentTimeMillis();
}
try {
if (resultSet == null) {
rs = getDBResultSet(false);
}
if (debug) {
Access.writeToConsole(myAccess, "SQLMAP, QUERY HAS BEEN EXECUTED, RETRIEVING RESULTSET\n");
}
if (rs != null) {
int columns = 0;
ResultSetMetaData meta = null;
try {
meta = rs.getMetaData();
columns = meta.getColumnCount();
} catch (Exception e) {
throw new UserException(-1, "Error getting metadata / columns", e);
}
// Check if previous version exists, if so, close it.
if (myResultSetIterator != null) {
myResultSetIterator.close();
}
myResultSetIterator = new ResultSetIterator(rs, meta, columns);
return myResultSetIterator;
} else {
return null;
}
} catch (SQLException sqle) {
sqle.printStackTrace(Access.getConsoleWriter(myAccess));
AuditLog.log("SQLMap", sqle.getMessage(), sqle, Level.SEVERE, (myAccess != null ? (myAccess != null ? myAccess.accessID : "unknown access") : "unknown access"));
throw new UserException(-1, sqle.getMessage(), sqle);
}
}
use of com.dexels.navajo.adapter.sqlmap.ResultSetIterator in project navajo by Dexels.
the class JDBCMap method getStreamingResultSet.
@Override
public Iterator<ResultSetMap> getStreamingResultSet() throws UserException {
ResultSet rs = null;
try {
if (resultSet == null) {
rs = getDBResultSet(false);
}
if (debug) {
Access.writeToConsole(myAccess, "SQLMAP, QUERY HAS BEEN EXECUTED, RETRIEVING RESULTSET\n");
}
if (rs != null) {
int columns = 0;
ResultSetMetaData meta = null;
try {
meta = rs.getMetaData();
columns = meta.getColumnCount();
} catch (Exception e) {
throw new UserException(-1, "Error getting metadata / columns", e);
}
// Check if previous version exists, if so, close it.
if (myResultSetIterator != null) {
myResultSetIterator.close();
}
myResultSetIterator = new ResultSetIterator(rs, meta, columns);
return myResultSetIterator;
} else {
return null;
}
} catch (SQLException sqle) {
AuditLog.log("SQLMap", sqle.getMessage(), Level.SEVERE, (myAccess != null ? (myAccess != null ? myAccess.accessID : "unknown access") : "unknown access"));
throw new UserException(-1, sqle.getMessage(), sqle);
}
}
Aggregations