void setConnection(Connection conn) throws SQLException { this.conn = conn; if (conn == null) { meta = null; } else { meta = conn.getMetaData(); } contents = new DbContents(); }
String url = (String) session.get("url"); Connection conn = session.getConnection(); contents.readContents(url, conn); session.loadBnf(); isH2 = contents.isH2(); int treeIndex = 1; DbSchema defaultSchema = contents.getDefaultSchema(); treeIndex = addTablesAndViews(defaultSchema, true, buff, treeIndex); DbSchema[] schemas = contents.getSchemas(); for (DbSchema schema : schemas) { if (schema == defaultSchema || schema == null) {
isMSSQLServer = url.startsWith("jdbc:sqlserver:"); DatabaseMetaData meta = conn.getMetaData(); String defaultSchemaName = getDefaultSchemaName(meta); String[] schemaNames = getSchemaNames(meta); schemas = new DbSchema[schemaNames.length]; for (int i = 0; i < schemaNames.length; i++) {
DbSchema(DbContents contents, String name, boolean isDefault) { this.contents = contents; this.name = name; this.quotedName = contents.quoteIdentifier(name); this.isDefault = isDefault; if (name == null) { // firebird isSystem = true; } else if ("INFORMATION_SCHEMA".equals(name)) { isSystem = true; } else if (!contents.isH2() && StringUtils.toUpperEnglish(name).startsWith("INFO")) { isSystem = true; } else if (contents.isPostgreSQL() && StringUtils.toUpperEnglish(name).startsWith("PG_")) { isSystem = true; } else if (contents.isDerby() && name.startsWith("SYS")) { isSystem = true; } else { isSystem = false; } }
parser = Bnf.getInstance(fileReader); DbContents contents = new DbContents(); contents.readContents(connection.getMetaData().getURL(), connection); DbContextRule columnRule = new DbContextRule(contents, DbContextRule.COLUMN); DbContextRule newAliasRule = new DbContextRule(contents, DbContextRule.NEW_TABLE_ALIAS);
session.put("result", result); } catch (Throwable e) { session.put("result", getStackTrace(0, e, session.getContents().isH2()));
return treeIndex; boolean isOracle = schema.getContents().isOracle(); boolean notManyTables = tables.length < SysProperties.CONSOLE_MAX_TABLES_LIST_INDEXES; for (DbTableOrView table : tables) { treeIndex = addColumns(mainSchema, view, buff, treeIndex, notManyTables, columnsBuffer); if (schema.getContents().isH2()) {
switch (type) { case SCHEMA: { DbSchema[] schemas = contents.getSchemas(); String best = null; DbSchema bestSchema = null; DbSchema schema = sentence.getLastMatchedSchema(); if (schema == null) { schema = contents.getDefaultSchema(); for (DbSchema schema : contents.getSchemas()) { for (DbTableOrView table : schema.getTables()) { if (table != last && set != null && !set.contains(table)) {
while (rs.next()) { DbTableOrView table = new DbTableOrView(this, rs); if (contents.isOracle() && table.getName().indexOf('$') > 0) { continue;
private void autoCompleteProcedure(Sentence sentence) { DbSchema schema = sentence.getLastMatchedSchema(); if (schema == null) { schema = contents.getDefaultSchema();
if (!session.getContents().isDB2()) { isUpdatable = rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE && rs.getType() != ResultSet.TYPE_FORWARD_ONLY;
DbSchema(DbContents contents, String name, boolean isDefault) { this.contents = contents; this.name = name; this.quotedName = contents.quoteIdentifier(name); this.isDefault = isDefault; if (name == null) { // firebird isSystem = true; } else if ("INFORMATION_SCHEMA".equals(name)) { isSystem = true; } else if (!contents.isH2() && StringUtils.toUpperEnglish(name).startsWith("INFO")) { isSystem = true; } else if (contents.isPostgreSQL() && StringUtils.toUpperEnglish(name).startsWith("PG_")) { isSystem = true; } else if (contents.isDerby() && name.startsWith("SYS")) { isSystem = true; } else { isSystem = false; } }
parser = Bnf.getInstance(null); try (Connection connection = dataSource.getConnection()) { DbContents contents = new DbContents(); contents.readContents(connection.getMetaData().getURL(), connection); DbContextRule columnRule = new DbContextRule(contents, DbContextRule.COLUMN); DbContextRule newAliasRule = new DbContextRule(contents, DbContextRule.NEW_TABLE_ALIAS);
return treeIndex; boolean isOracle = schema.getContents().isOracle(); boolean notManyTables = tables.length < SysProperties.CONSOLE_MAX_TABLES_LIST_INDEXES; for (DbTableOrView table : tables) { treeIndex = addColumns(mainSchema, view, buff, treeIndex, notManyTables, columnsBuffer); if (schema.getContents().isH2()) {
switch (type) { case SCHEMA: { DbSchema[] schemas = contents.getSchemas(); String best = null; DbSchema bestSchema = null; DbSchema schema = sentence.getLastMatchedSchema(); if (schema == null) { schema = contents.getDefaultSchema(); for (DbSchema schema : contents.getSchemas()) { for (DbTableOrView table : schema.getTables()) { if (table != last && set != null && !set.contains(table)) {
while (rs.next()) { DbTableOrView table = new DbTableOrView(this, rs); if (contents.isOracle() && table.getName().indexOf('$') > 0) { continue;
private void autoCompleteProcedure(Sentence sentence) { DbSchema schema = sentence.getLastMatchedSchema(); if (schema == null) { schema = contents.getDefaultSchema();
if (!session.getContents().isDB2()) { isUpdatable = rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE && rs.getType() != ResultSet.TYPE_FORWARD_ONLY;
String url = (String) session.get("url"); Connection conn = session.getConnection(); contents.readContents(url, conn); session.loadBnf(); isH2 = contents.isH2(); int treeIndex = 1; DbSchema defaultSchema = contents.getDefaultSchema(); treeIndex = addTablesAndViews(defaultSchema, true, buff, treeIndex); DbSchema[] schemas = contents.getSchemas(); for (DbSchema schema : schemas) { if (schema == defaultSchema || schema == null) {