/**
* Returns a count of the records in the specified table.
*
* @param con
* the SQLConnection to use to execute the count query.
* @param tableName
* the name of the table. This name should already be qualified by the schema.
*
* @return -1 if the table does not exist, otherwise the record count is returned.
*/
/**
* Returns a count of the records in the specified table.
*
* @param con
* the SQLConnection to use to execute the count query.
* @param tableName
* the name of the table. This name should already be qualified by the schema.
* @return -1 if the table does not exist, otherwise the record count is returned.
*/
private static int getTableCount(ISession session, String tableName) {
int result = -1;
ResultSet rs = null;
try {
String sql = "select count(*) from " + tableName;
rs = executeQuery(session, sql);
if (rs.next()) {
result = rs.getInt(1);
}
}
catch (Exception
e) {
/* Do Nothing - this can happen when the table doesn't exist */
}
finally {
SQLUtilities.closeResultSet( [[#variable18d4be20]]);
}
return result;
}
/**
* Returns a count of the records in the specified table.
*
* @param con
* the SQLConnection to use to execute the count query.
* @param tableName
* the name of the table
*
* @return -1 if the table does not exist, otherwise the record count is returned.
*/
/**
* Returns a count of the records in the specified table.
*
* @param con
* the SQLConnection to use to execute the count query.
* @param tableName
* the name of the table
* @return -1 if the table does not exist, otherwise the record count is returned.
*/
public static int getTableCount(ISession session, String catalog, String schema, String tableName, int sessionType) throws UserCancelledOperationException {
String table = getQualifiedObjectName(session, catalog, schema, tableName, sessionType);
return getTableCount(session, table);
}
|