use of com.google.security.zynamics.binnavi.Database.NodeParser.ParserException in project binnavi by google.
the class PostgreSQLCodeNodeLoader method load.
/**
* Loads the code nodes of a view.
*
* @param provider The connection to the database.
* @param view The view whose code nodes are loaded.
* @param nodes The loaded nodes are stored here.
* @param modules All modules of the database.
*
* @throws SQLException Thrown of loading the nodes failed.
* @throws CPartialLoadException Thrown if loading the nodes failed because a necessary module was
* not loaded.
*/
public static void load(final AbstractSQLProvider provider, final INaviView view, final List<INaviViewNode> nodes, final List<? extends INaviModule> modules) throws SQLException, CPartialLoadException {
Preconditions.checkNotNull(provider, "Error: provider argument can not be null");
Preconditions.checkNotNull(view, "Error: view argument can not be null");
Preconditions.checkNotNull(nodes, "Error: nodes argument can not be null");
Preconditions.checkNotNull(modules, "Error: modules argument can not be null");
final String query = " SELECT * FROM load_code_nodes(?) ";
final PreparedStatement statement = provider.getConnection().getConnection().prepareStatement(query, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
statement.setInt(1, view.getConfiguration().getId());
final ResultSet resultSet = statement.executeQuery();
try {
final CCodeNodeParser parser = new CCodeNodeParser(new SqlCodeNodeProvider(resultSet), modules, provider);
nodes.addAll(parser.parse());
} catch (final ParserException e) {
CUtilityFunctions.logException(e);
} finally {
resultSet.close();
}
}
Aggregations