Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java504
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterDescriptor.java33
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterRegistry.java80
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java55
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java95
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java166
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBIndex.java82
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java206
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchemaElement.java43
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBTable.java174
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBParameter.java49
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBStatement.java106
12 files changed, 0 insertions, 1593 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
deleted file mode 100644
index 89eea152ac..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBIndex;
-import org.eclipse.net4j.db.ddl.IDBTable;
-import org.eclipse.net4j.internal.db.bundle.OM;
-import org.eclipse.net4j.internal.db.ddl.DBField;
-import org.eclipse.net4j.internal.db.ddl.DBIndex;
-import org.eclipse.net4j.internal.db.ddl.DBTable;
-import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public abstract class DBAdapter implements IDBAdapter
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SQL, DBAdapter.class);
-
- private static final String[] SQL92_RESERVED_WORDS = { "ABSOLUTE", "ACTION", "ADD", "AFTER", "ALL", "ALLOCATE",
- "ALTER", "AND", "ANY", "ARE", "ARRAY", "AS", "ASC", "ASENSITIVE", "ASSERTION", "ASYMMETRIC", "AT", "ATOMIC",
- "AUTHORIZATION", "AVG", "BEFORE", "BEGIN", "BETWEEN", "BIGINT", "BINARY", "BIT", "BIT_LENGTH", "BLOB", "BOOLEAN",
- "BOTH", "BREADTH", "BY", "CALL", "CALLED", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CHAR", "CHARACTER",
- "CHARACTER_LENGTH", "CHAR_LENGTH", "CHECK", "CLOB", "CLOSE", "COALESCE", "COLLATE", "COLLATION", "COLUMN",
- "COMMIT", "CONDITION", "CONNECT", "CONNECTION", "CONSTRAINT", "CONSTRAINTS", "CONSTRUCTOR", "CONTAINS",
- "CONTINUE", "CONVERT", "CORRESPONDING", "COUNT", "CREATE", "CROSS", "CUBE", "CURRENT", "CURRENT_DATE",
- "CURRENT_DEFAULT_TRANSFORM_GROUP", "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
- "CURRENT_TRANSFORM_GROUP_FOR_TYPE", "CURRENT_USER", "CURSOR", "CYCLE", "DATA", "DATE", "DAY", "DEALLOCATE",
- "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DEFERRABLE", "DEFERRED", "DELETE", "DEPTH", "DEREF", "DESC", "DESCRIBE",
- "DESCRIPTOR", "DETERMINISTIC", "DIAGNOSTICS", "DISCONNECT", "DISTINCT", "DO", "DOMAIN", "DOUBLE", "DROP",
- "DYNAMIC", "EACH", "ELEMENT", "ELSE", "ELSEIF", "END", "EQUALS", "ESCAPE", "EXCEPT", "EXCEPTION", "EXEC",
- "EXECUTE", "EXISTS", "EXIT", "EXTERNAL", "EXTRACT", "FALSE", "FETCH", "FILTER", "FIRST", "FLOAT", "FOR",
- "FOREIGN", "FOUND", "FREE", "FROM", "FULL", "FUNCTION", "GENERAL", "GET", "GLOBAL", "GO", "GOTO", "GRANT",
- "GROUP", "GROUPING", "HANDLER", "HAVING", "HOLD", "HOUR", "IDENTITY", "IF", "IMMEDIATE", "IN", "INDICATOR",
- "INITIALLY", "INNER", "INOUT", "INPUT", "INSENSITIVE", "INSERT", "INT", "INTEGER", "INTERSECT", "INTERVAL",
- "INTO", "IS", "ISOLATION", "ITERATE", "JOIN", "KEY", "LANGUAGE", "LARGE", "LAST", "LATERAL", "LEADING", "LEAVE",
- "LEFT", "LEVEL", "LIKE", "LOCAL", "LOCALTIME", "LOCALTIMESTAMP", "LOCATOR", "LOOP", "LOWER", "MAP", "MATCH",
- "MAX", "MEMBER", "MERGE", "METHOD", "MIN", "MINUTE", "MODIFIES", "MODULE", "MONTH", "MULTISET", "NAMES",
- "NATIONAL", "NATURAL", "NCHAR", "NCLOB", "NEW", "NEXT", "NO", "NONE", "NOT", "NULL", "NULLIF", "NUMERIC",
- "OBJECT", "OCTET_LENGTH", "OF", "OLD", "ON", "ONLY", "OPEN", "OPTION", "OR", "ORDER", "ORDINALITY", "OUT",
- "OUTER", "OUTPUT", "OVER", "OVERLAPS", "PAD", "PARAMETER", "PARTIAL", "PARTITION", "PATH", "POSITION",
- "PRECISION", "PREPARE", "PRESERVE", "PRIMARY", "PRIOR", "PRIVILEGES", "PROCEDURE", "PUBLIC", "RANGE", "READ",
- "READS", "REAL", "RECURSIVE", "REF", "REFERENCES", "REFERENCING", "RELATIVE", "RELEASE", "REPEAT", "RESIGNAL",
- "RESTRICT", "RESULT", "RETURN", "RETURNS", "REVOKE", "RIGHT", "ROLE", "ROLLBACK", "ROLLUP", "ROUTINE", "ROW",
- "ROWS", "SAVEPOINT", "SCHEMA", "SCOPE", "SCROLL", "SEARCH", "SECOND", "SECTION", "SELECT", "SENSITIVE",
- "SESSION", "SESSION_USER", "SET", "SETS", "SIGNAL", "SIMILAR", "SIZE", "SMALLINT", "SOME", "SPACE", "SPECIFIC",
- "SPECIFICTYPE", "SQL", "SQLCODE", "SQLERROR", "SQLEXCEPTION", "SQLSTATE", "SQLWARNING", "START", "STATE",
- "STATIC", "SUBMULTISET", "SUBSTRING", "SUM", "SYMMETRIC", "SYSTEM", "SYSTEM_USER", "TABLE", "TABLESAMPLE",
- "TEMPORARY", "THEN", "TIME", "TIMESTAMP", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", "TO", "TRAILING", "TRANSACTION",
- "TRANSLATE", "TRANSLATION", "TREAT", "TRIGGER", "TRIM", "TRUE", "UNDER", "UNDO", "UNION", "UNIQUE", "UNKNOWN",
- "UNNEST", "UNTIL", "UPDATE", "UPPER", "USAGE", "USER", "USING", "VALUE", "VALUES", "VARCHAR", "VARYING", "VIEW",
- "WHEN", "WHENEVER", "WHERE", "WHILE", "WINDOW", "WITH", "WITHIN", "WITHOUT", "WORK", "WRITE", "YEAR", "ZONE" };
-
- private String name;
-
- private String version;
-
- private Set<String> reservedWords;
-
- public DBAdapter(String name, String version)
- {
- this.name = name;
- this.version = version;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public Set<IDBTable> createTables(Iterable<? extends IDBTable> tables, Connection connection) throws DBException
- {
- Set<IDBTable> createdTables = new HashSet<IDBTable>();
- Statement statement = null;
-
- try
- {
- statement = connection.createStatement();
- for (IDBTable table : tables)
- {
- if (createTable(table, statement))
- {
- createdTables.add(table);
- }
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
- {
- DBUtil.close(statement);
- }
-
- return createdTables;
- }
-
- public boolean createTable(IDBTable table, Statement statement) throws DBException
- {
- boolean created = true;
-
- try
- {
- doCreateTable((DBTable)table, statement);
- }
- catch (SQLException ex)
- {
- created = false;
- if (TRACER.isEnabled())
- {
- TRACER.trace("-- " + ex.getMessage());
- }
- }
-
- validateTable((DBTable)table, statement);
- return created;
- }
-
- public Collection<IDBTable> dropTables(Iterable<? extends IDBTable> tables, Connection connection) throws DBException
- {
- List<IDBTable> droppedTables = new ArrayList<IDBTable>();
- Statement statement = null;
-
- try
- {
- statement = connection.createStatement();
- for (IDBTable table : tables)
- {
- if (dropTable(table, statement))
- {
- droppedTables.add(table);
- }
- }
- }
- catch (SQLException ex)
- {
- OM.LOG.error(ex);
- }
- finally
- {
- DBUtil.close(statement);
- }
-
- return droppedTables;
- }
-
- public boolean dropTable(IDBTable table, Statement statement)
- {
- try
- {
- String sql = getDropTableSQL(table);
- if (TRACER.isEnabled())
- {
- TRACER.trace(sql);
- }
-
- statement.execute(sql);
- return true;
- }
- catch (SQLException ex)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace(ex.getMessage());
- }
-
- return false;
- }
- }
-
- protected String getDropTableSQL(IDBTable table)
- {
- return "DROP TABLE " + table;
- }
-
- public String mangleTableName(String name, int attempt)
- {
- return mangleName(name, getMaximumTableNameLength(), attempt);
- }
-
- public String mangleFieldName(String name, int attempt)
- {
- return mangleName(name, getMaximumFieldNameLength(), attempt);
- }
-
- public void appendValue(StringBuilder builder, IDBField field, Object value)
- {
- field.appendValue(builder, value);
- }
-
- public boolean isTypeIndexable(DBType type)
- {
- switch (type)
- {
- case CLOB:
- case BLOB:
- case LONGVARCHAR:
- case LONGVARBINARY:
- case VARBINARY:
- case BINARY:
- return false;
-
- default:
- return true;
- }
- }
-
- @Override
- public String toString()
- {
- return getName() + "-" + getVersion();
- }
-
- protected void doCreateTable(DBTable table, Statement statement) throws SQLException
- {
- StringBuilder builder = new StringBuilder();
- builder.append("CREATE TABLE ");
- builder.append(table);
- builder.append(" (");
- appendFieldDefs(builder, table, createFieldDefinitions(table));
- String constraints = createConstraints(table);
- if (constraints != null)
- {
- builder.append(", ");
- builder.append(constraints);
- }
-
- builder.append(")");
- String sql = builder.toString();
- if (TRACER.isEnabled())
- {
- TRACER.trace(sql);
- }
-
- System.out.println(sql);
- statement.execute(sql);
-
- DBIndex[] indices = table.getIndices();
- for (int i = 0; i < indices.length; i++)
- {
- createIndex(indices[i], statement, i);
- }
- }
-
- protected void createIndex(DBIndex index, Statement statement, int num) throws SQLException
- {
- DBTable table = index.getTable();
- StringBuilder builder = new StringBuilder();
- builder.append("CREATE ");
- if (index.getType() == IDBIndex.Type.UNIQUE)
- {
- builder.append("UNIQUE ");
- }
-
- builder.append("INDEX ");
- builder.append(table);
- builder.append("_idx");
- builder.append(num);
- builder.append(" ON ");
- builder.append(table);
- builder.append(" (");
- IDBField[] fields = index.getFields();
- for (int i = 0; i < fields.length; i++)
- {
- if (i != 0)
- {
- builder.append(", ");
- }
-
- addIndexField(builder, fields[i]);
- }
-
- builder.append(")");
- String sql = builder.toString();
- if (TRACER.isEnabled())
- {
- TRACER.trace(sql);
- }
- statement.execute(sql);
- }
-
- protected void addIndexField(StringBuilder builder, IDBField field)
- {
- builder.append(field);
- }
-
- protected String createConstraints(DBTable table)
- {
- return null;
- }
-
- protected String createFieldDefinition(DBField field)
- {
- return getTypeName(field) + (field.isNotNull() ? " NOT NULL" : "");
- }
-
- protected String getTypeName(DBField field)
- {
- DBType type = field.getType();
- switch (type)
- {
- case BOOLEAN:
- case BIT:
- case TINYINT:
- case SMALLINT:
- case INTEGER:
- case BIGINT:
- case FLOAT:
- case REAL:
- case DOUBLE:
- case DATE:
- case TIME:
- case TIMESTAMP:
- case LONGVARCHAR:
- case LONGVARBINARY:
- case BLOB:
- case CLOB:
- return type.toString();
-
- case CHAR:
- case VARCHAR:
- case BINARY:
- case VARBINARY:
- return type.toString() + field.formatPrecision();
-
- case NUMERIC:
- case DECIMAL:
- return type.toString() + field.formatPrecisionAndScale();
- }
-
- throw new IllegalArgumentException("Unknown type: " + type);
- }
-
- protected int getMaximumTableNameLength()
- {
- return 128;
- }
-
- protected int getMaximumFieldNameLength()
- {
- return 128;
- }
-
- protected String mangleName(String name, int max, int attempt)
- {
- if (isReservedWord(name))
- {
- String suffix = "_" + String.valueOf(attempt);
- if (name.length() + suffix.length() > max)
- {
- name = name.substring(0, max - suffix.length()) + suffix;
- }
- else
- {
- name += suffix;
- }
- }
- else if (name.length() > max)
- {
- name = name.substring(0, max);
- }
-
- return name;
- }
-
- public String[] getSQL92ReservedWords()
- {
- return SQL92_RESERVED_WORDS;
- }
-
- public boolean isReservedWord(String word)
- {
- if (reservedWords == null)
- {
- reservedWords = new HashSet<String>();
- for (String reservedWord : getReservedWords())
- {
- reservedWords.add(reservedWord.toUpperCase());
- }
- }
-
- word = word.toUpperCase();
- return reservedWords.contains(word);
- }
-
- protected void validateTable(DBTable table, Statement statement) throws DBException
- {
- try
- {
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT ");
- appendFieldNames(builder, table);
- builder.append(" FROM ");
- builder.append(table);
- String sql = builder.toString();
-
- ResultSet resultSet = statement.executeQuery(sql);
- ResultSetMetaData metaData = resultSet.getMetaData();
- int columnCount = metaData.getColumnCount();
- if (columnCount != table.getFieldCount())
- {
- throw new DBException("DBTable " + table + " has " + columnCount + " columns instead of "
- + table.getFieldCount());
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex.getMessage());
- }
- }
-
- private String[] createFieldDefinitions(DBTable table)
- {
- DBField[] fields = table.getFields();
- int fieldCount = fields.length;
-
- String[] result = new String[fieldCount];
- for (int i = 0; i < fieldCount; i++)
- {
- DBField field = fields[i];
- result[i] = createFieldDefinition(field);
- }
-
- return result;
- }
-
- public void appendFieldNames(Appendable appendable, IDBTable table)
- {
- try
- {
- IDBField[] fields = table.getFields();
- for (int i = 0; i < fields.length; i++)
- {
- IDBField field = fields[i];
- if (i != 0)
- {
- appendable.append(", ");
- }
-
- String fieldName = field.getName();
- appendable.append(fieldName);
- }
- }
- catch (IOException canNotHappen)
- {
- }
- }
-
- private void appendFieldDefs(Appendable appendable, IDBTable table, String[] defs)
- {
- try
- {
- IDBField[] fields = table.getFields();
- for (int i = 0; i < fields.length; i++)
- {
- IDBField field = fields[i];
- if (i != 0)
- {
- appendable.append(", ");
- }
-
- // String fieldName = mangleFieldName(field.getName(), 0);
- String fieldName = field.getName();
- appendable.append(fieldName);
- appendable.append(" ");
- appendable.append(defs[i]);
- }
- }
- catch (IOException canNotHappen)
- {
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterDescriptor.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterDescriptor.java
deleted file mode 100644
index ab75e8fb7f..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterDescriptor.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db;
-
-import org.eclipse.net4j.db.IDBAdapter;
-
-/**
- * @author Eike Stepper
- */
-public abstract class DBAdapterDescriptor
-{
- private String name;
-
- public DBAdapterDescriptor(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public abstract IDBAdapter createDBAdapter();
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterRegistry.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterRegistry.java
deleted file mode 100644
index a160be364b..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterRegistry.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db;
-
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.internal.util.registry.HashMapRegistry;
-import org.eclipse.net4j.util.registry.IRegistry;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class DBAdapterRegistry extends HashMapRegistry<String, IDBAdapter> implements IRegistry<String, IDBAdapter>
-{
- public static final DBAdapterRegistry INSTANCE = new DBAdapterRegistry();
-
- private Map<String, DBAdapterDescriptor> descriptors = new HashMap<String, DBAdapterDescriptor>();
-
- public DBAdapterRegistry()
- {
- }
-
- public DBAdapterRegistry(int initialCapacity)
- {
- super(initialCapacity);
- }
-
- public DBAdapterRegistry(int initialCapacity, float loadFactor)
- {
- super(initialCapacity, loadFactor);
- }
-
- public DBAdapterRegistry(Map<? extends String, ? extends IDBAdapter> m)
- {
- super(m);
- }
-
- @Override
- public IDBAdapter get(Object key)
- {
- IDBAdapter adapter = super.get(key);
- if (adapter == null)
- {
- if (key instanceof String)
- {
- DBAdapterDescriptor descriptor = descriptors.get(key);
- if (descriptor != null)
- {
- adapter = descriptor.createDBAdapter();
- if (adapter != null)
- {
- put((String)key, adapter);
- }
- }
- }
- }
-
- return adapter;
- }
-
- public DBAdapterDescriptor addDescriptor(DBAdapterDescriptor descriptor)
- {
- return descriptors.put(descriptor.getName(), descriptor);
- }
-
- public DBAdapterDescriptor removeDescriptor(String name)
- {
- return descriptors.remove(name);
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java
deleted file mode 100644
index f80e7383bc..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DataSourceConnectionProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.IDBConnectionProvider;
-
-import javax.sql.DataSource;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * @author Eike Stepper
- */
-public class DataSourceConnectionProvider implements IDBConnectionProvider
-{
- private DataSource dataSource;
-
- public DataSourceConnectionProvider(DataSource dataSource)
- {
- this.dataSource = dataSource;
- }
-
- public DataSource getDataSource()
- {
- return dataSource;
- }
-
- public Connection getConnection()
- {
- try
- {
- return dataSource.getConnection();
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- }
-
- @Override
- public String toString()
- {
- return dataSource.toString();
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
deleted file mode 100644
index 946f08cc02..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.bundle;
-
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.internal.db.DBAdapterDescriptor;
-import org.eclipse.net4j.internal.db.DBAdapterRegistry;
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.net4j.db"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_SQL = DEBUG.tracer("sql"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- public static final String EXT_POINT = "dbAdapters";
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
-
- @Override
- public void start(BundleContext context) throws Exception
- {
- super.start(context);
- initDBAdapterRegistry();
- }
-
- private void initDBAdapterRegistry()
- {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] elements = registry.getConfigurationElementsFor(BUNDLE_ID, EXT_POINT);
- for (final IConfigurationElement element : elements)
- {
- if ("dbAdapter".equals(element.getName()))
- {
- DBAdapterDescriptor descriptor = new DBAdapterDescriptor(element.getAttribute("name"))
- {
- @Override
- public IDBAdapter createDBAdapter()
- {
- try
- {
- return (IDBAdapter)element.createExecutableExtension("class");
- }
- catch (CoreException ex)
- {
- OM.LOG.error(ex);
- return null;
- }
- }
- };
-
- DBAdapterRegistry.INSTANCE.addDescriptor(descriptor);
- }
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java
deleted file mode 100644
index 5e59091b0f..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBField.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.ddl;
-
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBSchema;
-
-/**
- * @author Eike Stepper
- */
-public class DBField extends DBSchemaElement implements IDBField
-{
- public static final int DEFAULT_DECIMAL_PRECISION = 5;
-
- public static final int DEFAULT_SCALE = 0;
-
- public static final int DEFAULT_CHAR_LENGTH = 1;
-
- public static final int DEFAULT_VARCHAR_LENGTH = 255;
-
- private DBTable table;
-
- private String name;
-
- private DBType type;
-
- private int precision;
-
- private int scale;
-
- private boolean notNull;
-
- private int position;
-
- public DBField(DBTable table, String name, DBType type, int precision, int scale, boolean notNull, int position)
- {
- this.table = table;
- this.name = name;
- this.type = type;
- this.precision = precision;
- this.scale = scale;
- this.notNull = notNull;
- this.position = position;
- }
-
- public IDBSchema getSchema()
- {
- return table.getSchema();
- }
-
- public DBTable getTable()
- {
- return table;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public DBType getType()
- {
- return type;
- }
-
- public void setType(DBType type)
- {
- this.type = type;
- }
-
- public int getPrecision()
- {
- if (precision == DEFAULT)
- {
- switch (type)
- {
- case CHAR:
- return DEFAULT_CHAR_LENGTH;
-
- case VARCHAR:
- case VARBINARY:
- return DEFAULT_VARCHAR_LENGTH;
-
- case DECIMAL:
- case NUMERIC:
- return DEFAULT_DECIMAL_PRECISION;
- }
- }
-
- return precision;
- }
-
- public void setPrecision(int precision)
- {
- this.precision = precision;
- }
-
- public int getScale()
- {
- if (scale == DEFAULT)
- {
- return DEFAULT_SCALE;
- }
-
- return scale;
- }
-
- public void setScale(int scale)
- {
- this.scale = scale;
- }
-
- public boolean isNotNull()
- {
- return notNull;
- }
-
- public void setNotNull(boolean on)
- {
- notNull = on;
- }
-
- public int getPosition()
- {
- return position;
- }
-
- public String getFullName()
- {
- return table.getName() + "." + name;
- }
-
- public String formatPrecision()
- {
- return "(" + getPrecision() + ")";
- }
-
- public String formatPrecisionAndScale()
- {
- if (scale == DEFAULT)
- {
- return "(" + getPrecision() + ")";
- }
-
- return "(" + getPrecision() + ", " + scale + ")";
- }
-
- public void appendValue(StringBuilder builder, Object value)
- {
- type.appendValue(builder, value);
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBIndex.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBIndex.java
deleted file mode 100644
index 62c8912b9d..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBIndex.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.ddl;
-
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBIndex;
-import org.eclipse.net4j.db.ddl.IDBSchema;
-
-/**
- * @author Eike Stepper
- */
-public class DBIndex extends DBSchemaElement implements IDBIndex
-{
- private DBTable table;
-
- private Type type;
-
- private IDBField[] fields;
-
- public int position;
-
- public DBIndex(DBTable table, Type type, IDBField[] fields, int position)
- {
- this.table = table;
- this.type = type;
- this.fields = fields;
- this.position = position;
- }
-
- public IDBSchema getSchema()
- {
- return table.getSchema();
- }
-
- public DBTable getTable()
- {
- return table;
- }
-
- public Type getType()
- {
- return type;
- }
-
- public IDBField getField(int index)
- {
- return fields[index];
- }
-
- public int getFieldCount()
- {
- return fields.length;
- }
-
- public IDBField[] getFields()
- {
- return fields;
- }
-
- public int getPosition()
- {
- return position;
- }
-
- public String getName()
- {
- return "idx_" + table.getName() + "_" + position;
- }
-
- public String getFullName()
- {
- return getName();
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
deleted file mode 100644
index 93a0a70898..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchema.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.ddl;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBUtil;
-import org.eclipse.net4j.db.IDBAdapter;
-import org.eclipse.net4j.db.IDBConnectionProvider;
-import org.eclipse.net4j.db.IDBRowHandler;
-import org.eclipse.net4j.db.ddl.IDBSchema;
-import org.eclipse.net4j.db.ddl.IDBTable;
-
-import javax.sql.DataSource;
-
-import java.io.PrintStream;
-import java.sql.Connection;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class DBSchema extends DBSchemaElement implements IDBSchema
-{
- private String name;
-
- private Map<String, DBTable> tables = new HashMap<String, DBTable>();
-
- private boolean locked;
-
- public DBSchema(String name)
- {
- this.name = name;
- }
-
- public String getFullName()
- {
- return name;
- }
-
- public IDBSchema getSchema()
- {
- return this;
- }
-
- public String getName()
- {
- return name;
- }
-
- public DBTable addTable(String name) throws DBException
- {
- assertUnlocked();
- if (tables.containsKey(name))
- {
- throw new DBException("DBTable exists: " + name);
- }
-
- DBTable table = new DBTable(this, name);
- tables.put(name, table);
- return table;
- }
-
- public DBTable getTable(String name)
- {
- return tables.get(name);
- }
-
- public DBTable[] getTables()
- {
- return tables.values().toArray(new DBTable[tables.size()]);
- }
-
- public boolean isLocked()
- {
- return locked;
- }
-
- public boolean lock()
- {
- return locked = true;
- }
-
- public Set<IDBTable> create(IDBAdapter dbAdapter, Connection connection) throws DBException
- {
- return dbAdapter.createTables(tables.values(), connection);
- }
-
- public Set<IDBTable> create(IDBAdapter dbAdapter, DataSource dataSource) throws DBException
- {
- return create(dbAdapter, DBUtil.createConnectionProvider(dataSource));
- }
-
- public Set<IDBTable> create(IDBAdapter dbAdapter, IDBConnectionProvider connectionProvider) throws DBException
- {
- Connection connection = null;
-
- try
- {
- connection = connectionProvider.getConnection();
- return create(dbAdapter, connection);
- }
- finally
- {
- DBUtil.close(connection);
- }
- }
-
- public void drop(IDBAdapter dbAdapter, Connection connection) throws DBException
- {
- dbAdapter.dropTables(tables.values(), connection);
- }
-
- public void drop(IDBAdapter dbAdapter, DataSource dataSource) throws DBException
- {
- drop(dbAdapter, DBUtil.createConnectionProvider(dataSource));
- }
-
- public void drop(IDBAdapter dbAdapter, IDBConnectionProvider connectionProvider) throws DBException
- {
- Connection connection = null;
-
- try
- {
- connection = connectionProvider.getConnection();
- drop(dbAdapter, connection);
- }
- finally
- {
- DBUtil.close(connection);
- }
- }
-
- public void export(Connection connection, PrintStream out) throws DBException
- {
- for (DBTable table : getTables())
- {
- export(table, connection, out);
- }
- }
-
- private void export(final DBTable table, Connection connection, final PrintStream out)
- {
- if (DBUtil.select(connection, new IDBRowHandler()
- {
- public boolean handle(int row, Object... values)
- {
- if (row == 0)
- {
- String tableName = table.getName();
- out.println(tableName);
- for (int i = 0; i < tableName.length(); i++)
- {
- out.print("=");
- }
-
- out.println();
- }
-
- out.println(Arrays.asList(values));
- return true;
- }
- }, table.getFields()) > 0)
- {
- out.println();
- }
- }
-
- public void export(DataSource dataSource, PrintStream out) throws DBException
- {
- export(DBUtil.createConnectionProvider(dataSource), out);
- }
-
- public void export(IDBConnectionProvider connectionProvider, PrintStream out) throws DBException
- {
- Connection connection = null;
-
- try
- {
- connection = connectionProvider.getConnection();
- export(connection, out);
- }
- finally
- {
- DBUtil.close(connection);
- }
- }
-
- void assertUnlocked() throws DBException
- {
- if (locked)
- {
- throw new DBException("DBSchema locked: " + name);
- }
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchemaElement.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchemaElement.java
deleted file mode 100644
index 69d130e61f..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBSchemaElement.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.ddl;
-
-import org.eclipse.net4j.db.ddl.IDBSchemaElement;
-
-import java.util.Properties;
-
-/**
- * @author Eike Stepper
- */
-public abstract class DBSchemaElement implements IDBSchemaElement
-{
- private Properties properties;
-
- public DBSchemaElement()
- {
- }
-
- public Properties getProperties()
- {
- if (properties == null)
- {
- properties = new Properties();
- }
-
- return properties;
- }
-
- @Override
- public String toString()
- {
- return getName();
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBTable.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBTable.java
deleted file mode 100644
index 21662f9154..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/ddl/DBTable.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.ddl;
-
-import org.eclipse.net4j.db.DBException;
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBIndex;
-import org.eclipse.net4j.db.ddl.IDBTable;
-import org.eclipse.net4j.db.ddl.IDBIndex.Type;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class DBTable extends DBSchemaElement implements IDBTable
-{
- private DBSchema schema;
-
- private String name;
-
- private List<DBField> fields = new ArrayList<DBField>();
-
- private List<DBIndex> indices = new ArrayList<DBIndex>();
-
- public DBTable(DBSchema schema, String name)
- {
- this.schema = schema;
- this.name = name;
- }
-
- public DBSchema getSchema()
- {
- return schema;
- }
-
- public String getName()
- {
- return name;
- }
-
- public DBField addField(String name, DBType type)
- {
- return addField(name, type, IDBField.DEFAULT, IDBField.DEFAULT, false);
- }
-
- public DBField addField(String name, DBType type, boolean notNull)
- {
- return addField(name, type, IDBField.DEFAULT, IDBField.DEFAULT, notNull);
- }
-
- public DBField addField(String name, DBType type, int precision)
- {
- return addField(name, type, precision, IDBField.DEFAULT, false);
- }
-
- public DBField addField(String name, DBType type, int precision, boolean notNull)
- {
- return addField(name, type, precision, IDBField.DEFAULT, notNull);
- }
-
- public DBField addField(String name, DBType type, int precision, int scale)
- {
- return addField(name, type, precision, scale, false);
- }
-
- public DBField addField(String name, DBType type, int precision, int scale, boolean notNull)
- {
- schema.assertUnlocked();
- if (getField(name) != null)
- {
- throw new DBException("DBField exists: " + name);
- }
-
- DBField field = new DBField(this, name, type, precision, scale, notNull, fields.size());
- fields.add(field);
- return field;
- }
-
- public DBField getField(String name)
- {
- for (DBField field : fields)
- {
- if (name.equals(field.getName()))
- {
- return field;
- }
- }
-
- return null;
- }
-
- public DBField getField(int index)
- {
- return fields.get(index);
- }
-
- public int getFieldCount()
- {
- return fields.size();
- }
-
- public DBField[] getFields()
- {
- return fields.toArray(new DBField[fields.size()]);
- }
-
- public DBIndex addIndex(Type type, IDBField... fields)
- {
- schema.assertUnlocked();
- DBIndex index = new DBIndex(this, type, fields, indices.size());
- indices.add(index);
- return index;
- }
-
- public int getIndexCount()
- {
- return indices.size();
- }
-
- public DBIndex[] getIndices()
- {
- return indices.toArray(new DBIndex[indices.size()]);
- }
-
- public IDBIndex getPrimaryKeyIndex()
- {
- for (IDBIndex index : indices)
- {
- if (index.getType() == IDBIndex.Type.PRIMARY_KEY)
- {
- return index;
- }
- }
-
- return null;
- }
-
- public String getFullName()
- {
- return name;
- }
-
- public String sqlInsert()
- {
- StringBuilder builder = new StringBuilder();
- builder.append("INSERT INTO ");
- builder.append(getName());
- builder.append(" VALUES (");
-
- for (int i = 0; i < fields.size(); i++)
- {
- if (i > 0)
- {
- builder.append(", ");
- }
-
- builder.append("?");
- }
-
- builder.append(")");
- return builder.toString();
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBParameter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBParameter.java
deleted file mode 100644
index f367597308..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBParameter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.dml;
-
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.dml.IDBParameter;
-import org.eclipse.net4j.db.dml.IDBStatement;
-
-/**
- * @author Eike Stepper
- */
-public class DBParameter implements IDBParameter
-{
- private IDBStatement statement;
-
- private int position;
-
- private DBType type;
-
- public DBParameter(IDBStatement statement, int position, DBType type)
- {
- this.statement = statement;
- this.position = position;
- this.type = type;
- }
-
- public IDBStatement getStatement()
- {
- return statement;
- }
-
- public int getPosition()
- {
- return position;
- }
-
- public DBType getType()
- {
- return type;
- }
-}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBStatement.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBStatement.java
deleted file mode 100644
index b1c092425b..0000000000
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/dml/DBStatement.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.net4j.internal.db.dml;
-
-import org.eclipse.net4j.db.DBType;
-import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBSchemaElement;
-import org.eclipse.net4j.db.dml.IDBParameter;
-import org.eclipse.net4j.db.dml.IDBStatement;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class DBStatement implements IDBStatement
-{
- private static final DBParameter[] NO_PARAMETERS = {};
-
- private List<DBParameter> parameters;
-
- private List<Object> sequence = new ArrayList<Object>();
-
- public IDBParameter addParameter(DBType type)
- {
- int position = 0;
- if (parameters == null)
- {
- parameters = new ArrayList<DBParameter>();
- }
- else
- {
- position = parameters.size();
- }
-
- DBParameter parameter = new DBParameter(this, position, type);
- parameters.add(parameter);
- return parameter;
- }
-
- public IDBParameter addParameter(IDBField field)
- {
- return addParameter(field.getType());
- }
-
- public DBParameter[] getParameters()
- {
- if (parameters == null)
- {
- return NO_PARAMETERS;
- }
-
- return parameters.toArray(new DBParameter[parameters.size()]);
- }
-
- public void addSQL(String literal)
- {
- int tailPos = sequence.size() - 1;
- Object tail = sequence.get(tailPos);
- if (tail instanceof String)
- {
- sequence.set(tailPos, ((String)tail) + literal);
- }
- else
- {
- sequence.add(literal);
- }
- }
-
- public void addSQL(IDBParameter parameter)
- {
- sequence.add(parameter);
- }
-
- public void addSQL(IDBSchemaElement schemaElement)
- {
- addSQL(schemaElement.getName());
- }
-
- public String getSQL()
- {
- StringBuilder builder = new StringBuilder();
- for (Object element : sequence)
- {
- if (element instanceof IDBParameter)
- {
- builder.append("?");
- }
- else
- {
- builder.append(element);
- }
- }
-
- return builder.toString();
- }
-}

Back to the top