Skip to content

Instantly share code, notes, and snippets.

@Nitrodist
Created August 24, 2010 02:05
Show Gist options
  • Save Nitrodist/546766 to your computer and use it in GitHub Desktop.
Save Nitrodist/546766 to your computer and use it in GitHub Desktop.
public boolean isWidgetReferenced(int widgetId) {
try
{
String[] widget_tables = {"WIDGET_REGION", "WIDGET_OFFERING", "WIDGET_ORDERS",
"WIDGET_NEW", "WIDGET_HISTORY", "WIDGET_STATS_RECORDED",
"WIDGET_VIEWED", "WIDGET_SETS", "WIDGET_INSTALLED",
"WIDGET_PENDING", "WIDGET_JOURNAL" };
String query;
ResultSet rs = null;
int x = 0;
Connection connection = getConnection();
for (int i = 0; i < widget_tables.length; i++)
{
query = "SELECT COUNT(*) FROM " + widget_tables[i] + " WHERE widgetId=" + widgetId;
rs = connection.createStatement().executeQuery(query);
x = rs.getInt(1);
if (count > 0)
return false;
rs.next()
}
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment