/** * Returns a helper class for building SQL statements. */ final SQLBuilder helper() throws SQLException { assert Thread.holdsLock(this); if (helper == null) { helper = new SQLBuilder(connection().getMetaData(), quoteSchema); } return helper; }
/** * Returns a helper class for building SQL statements. */ final SQLBuilder helper() throws SQLException { assert Thread.holdsLock(this); if (helper == null) { helper = new SQLBuilder(connection().getMetaData(), quoteSchema); } return helper; }
final DatabaseMetaData md = connection().getMetaData(); try (ResultSet rs = md.getColumns(catalog, schema, table, null)) { while (rs.next()) {
final DatabaseMetaData md = connection().getMetaData(); try (ResultSet rs = md.getColumns(catalog, schema, table, null)) { while (rs.next()) {
final Connection connection = connection(); final DatabaseMetaData md = connection.getMetaData(); if (md.storesUpperCaseIdentifiers()) {
final Connection connection = connection(); final DatabaseMetaData md = connection.getMetaData(); if (md.storesUpperCaseIdentifiers()) {
/** * Creates a new generator. * * @param schema the schema, or {@code null} if none. * @param table the table name where to search for an identifier. * @param source information about the metadata database. * @param column name of the identifier (primary key) column. * @param buffer a helper object for building SQL statements, determined from database metadata. */ IdentifierGenerator(final MetadataSource source, final String schema, final String table, final String column, final SQLBuilder buffer) throws SQLException { assert Thread.holdsLock(source); this.buffer = buffer; buffer.clear().append("SELECT DISTINCT ") .appendIdentifier(column).append(" FROM ").appendIdentifier(schema, table).append(" WHERE ") .appendIdentifier(column).append(" LIKE ? ORDER BY ") .appendIdentifier(column); statement = source.connection().prepareStatement(buffer.toString()); }
/** * Creates a new generator. * * @param schema the schema, or {@code null} if none. * @param table the table name where to search for an identifier. * @param source information about the metadata database. * @param column name of the identifier (primary key) column. * @param buffer a helper object for building SQL statements, determined from database metadata. */ IdentifierGenerator(final MetadataSource source, final String schema, final String table, final String column, final SQLBuilder buffer) throws SQLException { assert Thread.holdsLock(source); this.buffer = buffer; buffer.clear().append("SELECT DISTINCT ") .appendIdentifier(column).append(" FROM ").appendIdentifier(schema, table).append(" WHERE ") .appendIdentifier(column).append(" LIKE ? ORDER BY ") .appendIdentifier(column); statement = source.connection().prepareStatement(buffer.toString()); }
try (Statement stmt = connection().createStatement()) { identifier = search(table, null, asMap, stmt, helper()); } catch (SQLException e) {
try (Statement stmt = connection().createStatement()) { identifier = search(table, null, asMap, stmt, helper()); } catch (SQLException e) {
.appendIdentifier(schema, tableName).append(" WHERE ") .append(ID_COLUMN).append("=?").toString(); result = new CachedStatement(type, connection().prepareStatement(query), listeners);
.appendIdentifier(schema, tableName).append(" WHERE ") .appendIdentifier(ID_COLUMN).append("=?").toString(); result = new CachedStatement(type, connection().prepareStatement(query), listeners);
stmt = source.connection().createStatement(); stmt.executeUpdate("CREATE TABLE \"" + TABLE + "\" (ID VARCHAR(6) NOT NULL PRIMARY KEY)"); generator = new IdentifierGenerator(source, null, TABLE, "ID", new SQLBuilder(source.connection().getMetaData(), false));