1 package net.sourceforge.phpdt.sql.adapters;
3 import java.sql.Connection;
4 import java.sql.DatabaseMetaData;
5 import java.sql.ResultSet;
6 import java.sql.SQLException;
7 import java.util.ArrayList;
10 import net.sourceforge.phpdt.sql.bookmarks.Bookmark;
11 import net.sourceforge.phpdt.sql.model.Entity;
12 import net.sourceforge.phpdt.sql.model.EntityFactory;
15 public class GenericAdapter extends DatabaseAdapter {
17 public String getShowTableQuery(DatabaseInfo info) {
20 public String getShowViewQuery(DatabaseInfo info) {
24 public String getShowSequenceQuery(DatabaseInfo info) {
32 * a schema name to filter on, or null to return all entities from all filters
34 * the type of entities (TABLES, VIEWS, etc.) to get
37 protected List getEntitiesList(Bookmark bookmark, Connection connection, String type)
40 List list = new ArrayList();
41 DatabaseMetaData metaData = connection.getMetaData();
42 ResultSet set = metaData.getTables(
43 null, bookmark.getSchema(), "%", new String[] { type });
45 String schema = set.getString("TABLE_SCHEM");
46 schema = (schema == null) ? "" : schema.trim();
47 String tableName = set.getString("TABLE_NAME").trim();
49 if (tableName.length() > 0) {
50 Entity entity = EntityFactory.getInstance().create(
51 bookmark, schema, tableName, type);