You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2013/02/20 22:06:37 UTC

svn commit: r1448414 [1/14] - in /db/torque/torque4/trunk/torque-runtime/src: main/java/org/apache/torque/ main/java/org/apache/torque/adapter/ main/java/org/apache/torque/criteria/ main/java/org/apache/torque/map/ main/java/org/apache/torque/oid/ main...

Author: tfischer
Date: Wed Feb 20 21:06:35 2013
New Revision: 1448414

URL: http://svn.apache.org/r1448414
Log:
set svn:keywords and svn:eol-style

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Column.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ConstraintViolationException.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/DeadlockException.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/OptimisticLockingFailedException.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criteria.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/CriteriaInterface.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Criterion.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/FromElement.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/Join.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/JoinType.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/PreparedStatementPart.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/package.html   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/ForeignKeyMap.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/InheritanceMap.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/map/MapHelper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AbstractIdGenerator.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ColumnAccessByName.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/BigDecimalMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/CompositeMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/DateMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/IntegerMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/LongMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/ObjectListMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/RecordMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/StringMapper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/package.html   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/package.html   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/OrderBy.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/WhereClauseExpression.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectOrColumnPsPartBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectPsPartBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/package.html   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/package.html   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/AbstractWhereClausePsPartBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CurrentDateTimePsPartBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CustomBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/InBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/LikeBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/NullValueBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/StandardBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/VerbatimSqlConditionBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/WhereClausePsPartBuilder.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/package.html   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ColumnValues.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ExceptionMapper.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ExceptionMapperImpl.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JdbcTypedValue.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ListOrderedMapCI.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/SummaryHelper.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/TransactionManager.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/TransactionManagerImpl.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/UniqueColumnList.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AbstractFunction.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/AggregateFunction.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Avg.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Count.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Max.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Min.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/SQLFunction.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/Sum.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/functions/package.html   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/ColumnImplTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/TorqueRuntimeExceptionTest.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/adapter/DBOracleTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/avalon/AvalonTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriterionTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/JoinTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/map/ColumnMapTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/BigDecimalMapperTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/CompositeMapperTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/DateMapperTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/IntegerMapperTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/LongMapperTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/ObjectListMapperTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/mapper/StringMapperTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderOldCriteriaTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java   (contents, props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/functions/AbstractFunctionTest.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/functions/AggregateFunctionTest.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/functions/AvgTest.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/functions/CountTest.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/functions/MaxTest.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/functions/MinTest.java   (props changed)
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/functions/SumTest.java   (props changed)

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Column.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Column.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Column.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Column.java Wed Feb 20 21:06:35 2013
@@ -1,72 +1,72 @@
-package org.apache.torque;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * The metadata of a column (or pseudocolumn) in a database.
- *
- * @version $Id$
- */
-public interface Column
-{
-    /**
-     * Returns the name of the database column (not prefixed by the table name).
-     *
-     * @return the name of the column, may be null.
-     *         (e.g. for the pseudocoulumn count(*)).
-     *         Is not blank.
-     */
-    String getColumnName();
-
-    /**
-     * Returns the name of the associated table
-     * (not prefixed by the schema name).
-     *
-     * @return the name of the table, may be null but not blank.
-     */
-    String getTableName();
-
-    /**
-     * Returns the name of any fixed schema prefix for the column's table
-     * (if any).
-     *
-     * @return the schema name, or null if the schema is not known.
-     */
-    String getSchemaName();
-
-    /**
-     * Returns the table name prefixed with the schema name if it exists.
-     * I.e. if a schema name exists, the result will be schemaName.tableName,
-     * and otherwise it will just be tableName.
-     *
-     * @return the fully qualified table name of the column,
-     *         may be null but not blank.
-     */
-    String getFullTableName();
-
-    /**
-     * Returns the SQL expression for the column, qualified by the
-     * table name but not by the schema name.
-     * This can also be a pseudocolumn (e.g. count(*)).
-     *
-     * @return the SQL expression for the column, not null.
-     */
-    String getSqlExpression();
-}
+package org.apache.torque;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The metadata of a column (or pseudocolumn) in a database.
+ *
+ * @version $Id$
+ */
+public interface Column
+{
+    /**
+     * Returns the name of the database column (not prefixed by the table name).
+     *
+     * @return the name of the column, may be null.
+     *         (e.g. for the pseudocoulumn count(*)).
+     *         Is not blank.
+     */
+    String getColumnName();
+
+    /**
+     * Returns the name of the associated table
+     * (not prefixed by the schema name).
+     *
+     * @return the name of the table, may be null but not blank.
+     */
+    String getTableName();
+
+    /**
+     * Returns the name of any fixed schema prefix for the column's table
+     * (if any).
+     *
+     * @return the schema name, or null if the schema is not known.
+     */
+    String getSchemaName();
+
+    /**
+     * Returns the table name prefixed with the schema name if it exists.
+     * I.e. if a schema name exists, the result will be schemaName.tableName,
+     * and otherwise it will just be tableName.
+     *
+     * @return the fully qualified table name of the column,
+     *         may be null but not blank.
+     */
+    String getFullTableName();
+
+    /**
+     * Returns the SQL expression for the column, qualified by the
+     * table name but not by the schema name.
+     * This can also be a pseudocolumn (e.g. count(*)).
+     *
+     * @return the SQL expression for the column, not null.
+     */
+    String getSqlExpression();
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Column.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java Wed Feb 20 21:06:35 2013
@@ -1,416 +1,416 @@
-package org.apache.torque;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-/**
- * An implementation of the column interface.
- * This class is immutable, i.e cannot be changed once constructed.
- *
- * @version $Id$
- */
-public class ColumnImpl implements Column, Serializable
-{
-    /** Serial version uid. **/
-    private static final long serialVersionUID = 1L;
-
-    /** Delimiters for SQL functions. */
-    private static final String[] FUNCTION_DELIMITERS
-            = {" ", ",", "(", ")", "<", ">"};
-
-    /** Constant for the dot. */
-    private static final String DOT = ".";
-
-    /** The column name, may be null but not empty. */
-    private String columnName;
-
-    /** The table name, may be null but not empty. */
-    private String tableName;
-
-    /** The schema name, may be null but not empty. */
-    private String schemaName;
-
-    /** The SQL expression for the column, not null. */
-    private String sqlExpression;
-
-    /**
-     * Constructor.
-     *
-     * @param tableName the table name, not null or blank.
-     * @param columnName the column name, not null or blank.
-     *
-     * @throws NullPointerException if columnName or tableName are null.
-     * @throws IllegalArgumentException if columnName or tableName are blank.
-     */
-    public ColumnImpl(String tableName, String columnName)
-    {
-        if (columnName == null)
-        {
-            throw new NullPointerException("columnName must not be null");
-        }
-        if (tableName == null)
-        {
-            throw new NullPointerException("tableName must not be null");
-        }
-        setColumnName(columnName);
-        setTableName(tableName);
-        this.sqlExpression = tableName + DOT + columnName;
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param schemaName the schema name, may be null but not blank.
-     * @param tableName the table name, may be null but not blank.
-     *        If it contains a dot, then only the portion after the dot
-     *        will be taken as table name.
-     *        If it contains a dot and schemaName is null, then the schema
-     *        name will be set as the portion before the dot.
-     * @param columnName the column name, not null or blank.
-     *
-     * @throws NullPointerException if columnName or tableName are null.
-     * @throws IllegalArgumentException if columnName or tableName are blank.
-     */
-    public ColumnImpl(String schemaName, String tableName, String columnName)
-    {
-        if (columnName == null)
-        {
-            throw new NullPointerException("columnName must not be null");
-        }
-        setColumnName(columnName);
-        setTableName(tableName);
-        setSchemaName(schemaName);
-        if (this.tableName == null)
-        {
-            this.sqlExpression = this.columnName;
-        }
-        else
-        {
-            this.sqlExpression = this.tableName + DOT + this.columnName;
-        }
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param schemaName the schema name, may be null but not blank.
-     * @param tableName the table name, may be null but not blank.
-     *        If it contains a dot, then only the portion after the dot
-     *        will be taken as table name.
-     *        If it contains a dot and schemaName is null, then the schema
-     *        name will be set as the portion before the dot.
-     * @param columnName the column name, may be null but not blank.
-     * @param sqlExpression the SQL expression for the column,
-     *        not null or blank.
-     *
-     * @throws NullPointerException if tableName or sqlExpression are null.
-     * @throws IllegalArgumentException if tableName or sqlExpression are blank.
-     */
-    public ColumnImpl(
-            String schemaName,
-            String tableName,
-            String columnName,
-            String sqlExpression)
-    {
-        setColumnName(columnName);
-        setTableName(tableName);
-        setSchemaName(schemaName);
-        setSqlExpression(sqlExpression);
-    }
-
-
-    /**
-     * Constructor which tries to guess schema, table and column names from
-     * an SQL expression. If a schema name can be identified in the
-     * SQL expression, it is removed from the SQL expression in the column.
-     *
-     * @param sqlExpression the SQL expression, not null, not blank.
-     *
-     * @throws NullPointerException if sqlExpression is null.
-     * @throws IllegalArgumentException if table or column name cannot be
-     *         guessed from sqlExpression.
-     */
-    public ColumnImpl(String sqlExpression)
-    {
-        setSqlExpression(sqlExpression);
-
-        // Find Table.Column
-        int dotIndex = sqlExpression.lastIndexOf(DOT);
-        if (dotIndex == -1)
-        {
-            if (StringUtils.contains(sqlExpression, "*"))
-            {
-                return;
-            }
-            if (StringUtils.indexOfAny(sqlExpression, FUNCTION_DELIMITERS)
-                    != -1)
-            {
-                throw new IllegalArgumentException("sqlExpression "
-                    + sqlExpression
-                    + " is unparseable, it does not contain a dot (.) "
-                    + " but function delimiters.");
-            }
-            setColumnName(sqlExpression);
-            return;
-        }
-        String pre = sqlExpression.substring(0, dotIndex);
-        String post = sqlExpression.substring(
-                dotIndex + 1,
-                sqlExpression.length());
-        if (StringUtils.isBlank(pre))
-        {
-            throw new IllegalArgumentException("sqlExpression "
-                    + sqlExpression
-                    + " is blank before the dot (.)");
-        }
-        int startIndex = StringUtils.lastIndexOfAny(pre, FUNCTION_DELIMITERS);
-        int endIndex = StringUtils.indexOfAny(post, FUNCTION_DELIMITERS);
-        if (endIndex < 0)
-        {
-            endIndex = sqlExpression.length();
-        }
-        else
-        {
-            // relative to sqlExpression not to post
-            endIndex += dotIndex + 1;
-        }
-
-        if (startIndex + 1 == dotIndex)
-        {
-            throw new IllegalArgumentException("sqlExpression "
-                    + sqlExpression
-                    + " is blank between the last function delimiter ("
-                    + StringUtils.join(FUNCTION_DELIMITERS)
-                    + ") and the dot");
-        }
-        setColumnName(sqlExpression.substring(dotIndex + 1, endIndex));
-        // if startIndex == -1 the formula is correct
-        String fullTableName
-                = sqlExpression.substring(startIndex + 1, dotIndex);
-        setTableName(fullTableName);
-        if (fullTableName.contains(DOT))
-        {
-            int fullTableNameDotIndex = fullTableName.lastIndexOf(DOT);
-            String extractedSchemaName
-                = fullTableName.substring(0, fullTableNameDotIndex);
-            setSchemaName(extractedSchemaName);
-            StringBuilder sqlExpressionBuilder = new StringBuilder();
-            if (startIndex != -1)
-            {
-                sqlExpressionBuilder.append(
-                        sqlExpression.substring(0, startIndex + 1));
-            }
-            sqlExpressionBuilder.append(getTableName())
-                    .append(DOT)
-                    .append(post);
-            setSqlExpression(sqlExpressionBuilder.toString());
-        }
-    }
-
-    /**
-     * Returns the column name.
-     *
-     * @return the column name, may be null.
-     */
-    public String getColumnName()
-    {
-        return columnName;
-    }
-
-    /**
-     * Sets the column name, using null if * is passed.
-     *
-     * @param columnName the column name, not blank.
-     */
-    private void setColumnName(String columnName)
-    {
-        if (columnName != null && StringUtils.isBlank(columnName))
-        {
-            throw new IllegalArgumentException("columnName must not be blank");
-        }
-        if ("*".equals(columnName))
-        {
-            this.columnName = null;
-        }
-        else
-        {
-            this.columnName = columnName;
-        }
-    }
-
-    /**
-     * Returns the table name.
-     *
-     * @return the table name, may be null.
-     */
-    public String getTableName()
-    {
-        return tableName;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getFullTableName()
-    {
-        if (schemaName != null)
-        {
-            return schemaName + '.' + tableName;
-        }
-        return tableName;
-    }
-
-    /**
-     * Sets the table name.
-     * If a table name with schema prefix is passed, then the unqualified table
-     * name is used as table name and the schema name will be set to the
-     * extracted schema name.
-     *
-     * @param tableName the table name, not blank, may be null.
-     *
-     * @throws IllegalArgumentException if tableName is blank or null.
-     */
-    private void setTableName(String tableName)
-    {
-        if (tableName != null && StringUtils.isBlank(tableName))
-        {
-            throw new IllegalArgumentException("tableName must not be blank");
-        }
-        if (StringUtils.contains(tableName, DOT))
-        {
-            int dotIndex = tableName.lastIndexOf(DOT);
-            this.schemaName = tableName.substring(0, dotIndex);
-            this.tableName = tableName.substring(dotIndex + 1);
-            return;
-        }
-        this.tableName = tableName;
-    }
-
-    /**
-     * Returns the name of any fixed schema prefix for the column's table
-     * (if any).
-     *
-     * @return the schema name, or null if the schema is not known.
-     */
-    public String getSchemaName()
-    {
-        return schemaName;
-    }
-
-    /**
-     * Sets the schema name, if a non-null value is passed.
-     *
-     * @param schemaName the schema name, or null.
-     *
-     * @throws IllegalArgumentException if schemaName is blank.
-     */
-    private void setSchemaName(String schemaName)
-    {
-        if (schemaName == null)
-        {
-            return;
-        }
-        if (StringUtils.isBlank(schemaName))
-        {
-            throw new IllegalArgumentException("schemaName must not be blank");
-        }
-        this.schemaName = schemaName;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getSqlExpression()
-    {
-        return sqlExpression;
-    }
-
-    /**
-     * Sets the sql expression.
-     *
-     * @param sqlExpression the sql expression, not null.
-     *
-     * @throws NullPointerException if sqlExpression is null.
-     * @throws IllegalArgumentException if sqlExpression is blank.
-     */
-    private void setSqlExpression(String sqlExpression)
-    {
-        if (sqlExpression == null)
-        {
-            throw new IllegalArgumentException(
-                    "sqlExpression must not be null");
-        }
-        if (StringUtils.isBlank(sqlExpression))
-        {
-            throw new IllegalArgumentException(
-                    "sqlExpression must not be blank");
-        }
-        this.sqlExpression = sqlExpression;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return new HashCodeBuilder()
-            .append(sqlExpression)
-            .append(columnName)
-            .append(tableName)
-            .append(schemaName)
-            .toHashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-        {
-            return true;
-        }
-        if (obj == null)
-        {
-            return false;
-        }
-        if (getClass() != obj.getClass())
-        {
-            return false;
-        }
-        ColumnImpl other = (ColumnImpl) obj;
-        return new EqualsBuilder()
-            .append(sqlExpression, other.sqlExpression)
-            .append(columnName, other.columnName)
-            .append(tableName, other.tableName)
-            .append(schemaName, other.schemaName)
-            .isEquals();
-    }
-
-    @Override
-    public String toString()
-    {
-        return "ColumnImpl [columnName=" + columnName
-                + ", tableName=" + tableName
-                + ", schemaName=" + schemaName
-                + ", sqlExpression=" + sqlExpression + "]";
-    }
-}
+package org.apache.torque;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+/**
+ * An implementation of the column interface.
+ * This class is immutable, i.e cannot be changed once constructed.
+ *
+ * @version $Id$
+ */
+public class ColumnImpl implements Column, Serializable
+{
+    /** Serial version uid. **/
+    private static final long serialVersionUID = 1L;
+
+    /** Delimiters for SQL functions. */
+    private static final String[] FUNCTION_DELIMITERS
+            = {" ", ",", "(", ")", "<", ">"};
+
+    /** Constant for the dot. */
+    private static final String DOT = ".";
+
+    /** The column name, may be null but not empty. */
+    private String columnName;
+
+    /** The table name, may be null but not empty. */
+    private String tableName;
+
+    /** The schema name, may be null but not empty. */
+    private String schemaName;
+
+    /** The SQL expression for the column, not null. */
+    private String sqlExpression;
+
+    /**
+     * Constructor.
+     *
+     * @param tableName the table name, not null or blank.
+     * @param columnName the column name, not null or blank.
+     *
+     * @throws NullPointerException if columnName or tableName are null.
+     * @throws IllegalArgumentException if columnName or tableName are blank.
+     */
+    public ColumnImpl(String tableName, String columnName)
+    {
+        if (columnName == null)
+        {
+            throw new NullPointerException("columnName must not be null");
+        }
+        if (tableName == null)
+        {
+            throw new NullPointerException("tableName must not be null");
+        }
+        setColumnName(columnName);
+        setTableName(tableName);
+        this.sqlExpression = tableName + DOT + columnName;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param schemaName the schema name, may be null but not blank.
+     * @param tableName the table name, may be null but not blank.
+     *        If it contains a dot, then only the portion after the dot
+     *        will be taken as table name.
+     *        If it contains a dot and schemaName is null, then the schema
+     *        name will be set as the portion before the dot.
+     * @param columnName the column name, not null or blank.
+     *
+     * @throws NullPointerException if columnName or tableName are null.
+     * @throws IllegalArgumentException if columnName or tableName are blank.
+     */
+    public ColumnImpl(String schemaName, String tableName, String columnName)
+    {
+        if (columnName == null)
+        {
+            throw new NullPointerException("columnName must not be null");
+        }
+        setColumnName(columnName);
+        setTableName(tableName);
+        setSchemaName(schemaName);
+        if (this.tableName == null)
+        {
+            this.sqlExpression = this.columnName;
+        }
+        else
+        {
+            this.sqlExpression = this.tableName + DOT + this.columnName;
+        }
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param schemaName the schema name, may be null but not blank.
+     * @param tableName the table name, may be null but not blank.
+     *        If it contains a dot, then only the portion after the dot
+     *        will be taken as table name.
+     *        If it contains a dot and schemaName is null, then the schema
+     *        name will be set as the portion before the dot.
+     * @param columnName the column name, may be null but not blank.
+     * @param sqlExpression the SQL expression for the column,
+     *        not null or blank.
+     *
+     * @throws NullPointerException if tableName or sqlExpression are null.
+     * @throws IllegalArgumentException if tableName or sqlExpression are blank.
+     */
+    public ColumnImpl(
+            String schemaName,
+            String tableName,
+            String columnName,
+            String sqlExpression)
+    {
+        setColumnName(columnName);
+        setTableName(tableName);
+        setSchemaName(schemaName);
+        setSqlExpression(sqlExpression);
+    }
+
+
+    /**
+     * Constructor which tries to guess schema, table and column names from
+     * an SQL expression. If a schema name can be identified in the
+     * SQL expression, it is removed from the SQL expression in the column.
+     *
+     * @param sqlExpression the SQL expression, not null, not blank.
+     *
+     * @throws NullPointerException if sqlExpression is null.
+     * @throws IllegalArgumentException if table or column name cannot be
+     *         guessed from sqlExpression.
+     */
+    public ColumnImpl(String sqlExpression)
+    {
+        setSqlExpression(sqlExpression);
+
+        // Find Table.Column
+        int dotIndex = sqlExpression.lastIndexOf(DOT);
+        if (dotIndex == -1)
+        {
+            if (StringUtils.contains(sqlExpression, "*"))
+            {
+                return;
+            }
+            if (StringUtils.indexOfAny(sqlExpression, FUNCTION_DELIMITERS)
+                    != -1)
+            {
+                throw new IllegalArgumentException("sqlExpression "
+                    + sqlExpression
+                    + " is unparseable, it does not contain a dot (.) "
+                    + " but function delimiters.");
+            }
+            setColumnName(sqlExpression);
+            return;
+        }
+        String pre = sqlExpression.substring(0, dotIndex);
+        String post = sqlExpression.substring(
+                dotIndex + 1,
+                sqlExpression.length());
+        if (StringUtils.isBlank(pre))
+        {
+            throw new IllegalArgumentException("sqlExpression "
+                    + sqlExpression
+                    + " is blank before the dot (.)");
+        }
+        int startIndex = StringUtils.lastIndexOfAny(pre, FUNCTION_DELIMITERS);
+        int endIndex = StringUtils.indexOfAny(post, FUNCTION_DELIMITERS);
+        if (endIndex < 0)
+        {
+            endIndex = sqlExpression.length();
+        }
+        else
+        {
+            // relative to sqlExpression not to post
+            endIndex += dotIndex + 1;
+        }
+
+        if (startIndex + 1 == dotIndex)
+        {
+            throw new IllegalArgumentException("sqlExpression "
+                    + sqlExpression
+                    + " is blank between the last function delimiter ("
+                    + StringUtils.join(FUNCTION_DELIMITERS)
+                    + ") and the dot");
+        }
+        setColumnName(sqlExpression.substring(dotIndex + 1, endIndex));
+        // if startIndex == -1 the formula is correct
+        String fullTableName
+                = sqlExpression.substring(startIndex + 1, dotIndex);
+        setTableName(fullTableName);
+        if (fullTableName.contains(DOT))
+        {
+            int fullTableNameDotIndex = fullTableName.lastIndexOf(DOT);
+            String extractedSchemaName
+                = fullTableName.substring(0, fullTableNameDotIndex);
+            setSchemaName(extractedSchemaName);
+            StringBuilder sqlExpressionBuilder = new StringBuilder();
+            if (startIndex != -1)
+            {
+                sqlExpressionBuilder.append(
+                        sqlExpression.substring(0, startIndex + 1));
+            }
+            sqlExpressionBuilder.append(getTableName())
+                    .append(DOT)
+                    .append(post);
+            setSqlExpression(sqlExpressionBuilder.toString());
+        }
+    }
+
+    /**
+     * Returns the column name.
+     *
+     * @return the column name, may be null.
+     */
+    public String getColumnName()
+    {
+        return columnName;
+    }
+
+    /**
+     * Sets the column name, using null if * is passed.
+     *
+     * @param columnName the column name, not blank.
+     */
+    private void setColumnName(String columnName)
+    {
+        if (columnName != null && StringUtils.isBlank(columnName))
+        {
+            throw new IllegalArgumentException("columnName must not be blank");
+        }
+        if ("*".equals(columnName))
+        {
+            this.columnName = null;
+        }
+        else
+        {
+            this.columnName = columnName;
+        }
+    }
+
+    /**
+     * Returns the table name.
+     *
+     * @return the table name, may be null.
+     */
+    public String getTableName()
+    {
+        return tableName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getFullTableName()
+    {
+        if (schemaName != null)
+        {
+            return schemaName + '.' + tableName;
+        }
+        return tableName;
+    }
+
+    /**
+     * Sets the table name.
+     * If a table name with schema prefix is passed, then the unqualified table
+     * name is used as table name and the schema name will be set to the
+     * extracted schema name.
+     *
+     * @param tableName the table name, not blank, may be null.
+     *
+     * @throws IllegalArgumentException if tableName is blank or null.
+     */
+    private void setTableName(String tableName)
+    {
+        if (tableName != null && StringUtils.isBlank(tableName))
+        {
+            throw new IllegalArgumentException("tableName must not be blank");
+        }
+        if (StringUtils.contains(tableName, DOT))
+        {
+            int dotIndex = tableName.lastIndexOf(DOT);
+            this.schemaName = tableName.substring(0, dotIndex);
+            this.tableName = tableName.substring(dotIndex + 1);
+            return;
+        }
+        this.tableName = tableName;
+    }
+
+    /**
+     * Returns the name of any fixed schema prefix for the column's table
+     * (if any).
+     *
+     * @return the schema name, or null if the schema is not known.
+     */
+    public String getSchemaName()
+    {
+        return schemaName;
+    }
+
+    /**
+     * Sets the schema name, if a non-null value is passed.
+     *
+     * @param schemaName the schema name, or null.
+     *
+     * @throws IllegalArgumentException if schemaName is blank.
+     */
+    private void setSchemaName(String schemaName)
+    {
+        if (schemaName == null)
+        {
+            return;
+        }
+        if (StringUtils.isBlank(schemaName))
+        {
+            throw new IllegalArgumentException("schemaName must not be blank");
+        }
+        this.schemaName = schemaName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSqlExpression()
+    {
+        return sqlExpression;
+    }
+
+    /**
+     * Sets the sql expression.
+     *
+     * @param sqlExpression the sql expression, not null.
+     *
+     * @throws NullPointerException if sqlExpression is null.
+     * @throws IllegalArgumentException if sqlExpression is blank.
+     */
+    private void setSqlExpression(String sqlExpression)
+    {
+        if (sqlExpression == null)
+        {
+            throw new IllegalArgumentException(
+                    "sqlExpression must not be null");
+        }
+        if (StringUtils.isBlank(sqlExpression))
+        {
+            throw new IllegalArgumentException(
+                    "sqlExpression must not be blank");
+        }
+        this.sqlExpression = sqlExpression;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return new HashCodeBuilder()
+            .append(sqlExpression)
+            .append(columnName)
+            .append(tableName)
+            .append(schemaName)
+            .toHashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+        {
+            return true;
+        }
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        ColumnImpl other = (ColumnImpl) obj;
+        return new EqualsBuilder()
+            .append(sqlExpression, other.sqlExpression)
+            .append(columnName, other.columnName)
+            .append(tableName, other.tableName)
+            .append(schemaName, other.schemaName)
+            .isEquals();
+    }
+
+    @Override
+    public String toString()
+    {
+        return "ColumnImpl [columnName=" + columnName
+                + ", tableName=" + tableName
+                + ", schemaName=" + schemaName
+                + ", sqlExpression=" + sqlExpression + "]";
+    }
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ColumnImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/ConstraintViolationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java Wed Feb 20 21:06:35 2013
@@ -1,306 +1,306 @@
-package org.apache.torque;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.adapter.IDMethod;
-import org.apache.torque.dsfactory.DataSourceFactory;
-import org.apache.torque.map.ColumnMap;
-import org.apache.torque.map.DatabaseMap;
-import org.apache.torque.map.TableMap;
-import org.apache.torque.oid.IDBroker;
-import org.apache.torque.oid.IdGenerator;
-
-/**
- * Bundles all information about a database. This includes the database adapter,
- * the database Map and the Data Source Factory.
- */
-public class Database
-{
-    /**
-     * The name of the database.
-     */
-    private final String name;
-
-    /**
-     * The Database adapter which encapsulates database-specific peculiarities.
-     */
-    private Adapter adapter;
-
-    /**
-     * The Map of this database.
-     */
-    private DatabaseMap databaseMap;
-
-    /**
-     * The DataSourceFactory to obtain connections to this database.
-     */
-    private DataSourceFactory dataSourceFactory;
-
-    /** The Schema name of this database, may be null if not set. */
-    private String schema = null;
-
-    /**
-     * A special table used to generate primary keys for the other tables.
-     */
-    private TableMap idTable = null;
-
-    /** The IDBroker that goes with the idTable. */
-    private IDBroker idBroker = null;
-
-    /** The IdGenerators, keyed by type of idMethod. */
-    private final Map<IDMethod, IdGenerator> idGenerators
-        = new HashMap<IDMethod, IdGenerator>();
-
-    /**
-     * Creates a new Database with the given name.
-     *
-     * @param name the name of the database, not null.
-     *
-     * @throws NullPointerException if name is null.
-     */
-    Database(String name)
-    {
-        if (name == null)
-        {
-            throw new NullPointerException("name is null");
-        }
-        this.name = name;
-    }
-
-    /**
-     * Rturns the name of the database.
-     *
-     * @return the name of the database, not null.
-     */
-    public String getName()
-    {
-        return name;
-    }
-
-    /**
-     * Returns the adapter to this database.
-     *
-     * @return the adapter to this database, or null if no adapter is set.
-     */
-    public Adapter getAdapter()
-    {
-        return adapter;
-    }
-
-    /**
-     * Sets the adapter for this database.
-     *
-     * @param anAdapter The adapter for this database, or null to remove the
-     *        current adapter from this database.
-     */
-    public void setAdapter(Adapter anAdapter)
-    {
-        this.adapter = anAdapter;
-    }
-
-    /**
-     * Returns the database map for this database.
-     * If the database map does not exist yet, it is created by this method.
-     */
-    public synchronized DatabaseMap getDatabaseMap()
-    {
-        if (databaseMap == null)
-        {
-            databaseMap = new DatabaseMap(this);
-        }
-        return databaseMap;
-    }
-
-    /**
-     * Returns the DataSourceFactory for this database.
-     * The DataSourceFactory is responsible to create connections
-     * to this database.
-     *
-     * @return the DataSourceFactory for this database, or null if no
-     *         DataSourceFactory exists for this database.
-     */
-    public DataSourceFactory getDataSourceFactory()
-    {
-        return dataSourceFactory;
-    }
-
-    /**
-     * Sets the DataSourceFactory for this database.
-     * The DataSourceFactory is responsible to create connections
-     * to this database.
-     *
-     * @param aDataSourceFactory The new DataSorceFactory for this database,
-     *        or null to remove the current DataSourceFactory.
-     */
-    public void setDataSourceFactory(DataSourceFactory aDataSourceFactory)
-    {
-        this.dataSourceFactory = aDataSourceFactory;
-    }
-
-    /**
-     * Get the ID table for this database.
-     *
-     * @return A TableMap, or null if not yet initialized or no id table exists
-     *         for this database.
-     */
-    public TableMap getIdTable()
-    {
-        return idTable;
-    }
-
-    /**
-     * Set the ID table for this database.
-     *
-     * @param idTable The TableMap representation for the ID table.
-     */
-    public void setIdTable(TableMap idTable)
-    {
-        this.idTable = idTable;
-        getDatabaseMap().setIdTable(idTable);
-    }
-
-    /**
-     * Set the ID table for this database.
-     *
-     * @param tableName The name for the ID table.
-     */
-    public void setIdTable(String tableName)
-    {
-        TableMap tmap = new TableMap(tableName, getDatabaseMap());
-        setIdTable(tmap);
-    }
-
-    /**
-     * Get the IDBroker for this database.
-     *
-     * @return The IDBroker for this database, or null if no IdBroker has
-     *         been started for this database.
-     */
-    public IDBroker getIdBroker()
-    {
-        return idBroker;
-    }
-
-    /**
-     * Creates the IDBroker for this Database and registers it with Torque.
-     * so it is either started instantly if Torque is already initialized
-     * or it is started when Torque is initialized.
-     * The information about the IdTable is stored in the databaseMap.
-     * If an IDBroker already exists for this Database, the method
-     * does nothing.
-     *
-     * @return true if a new IDBroker was created, false otherwise.
-     *
-     * @deprecated This method will be removed in a future version of Torque.
-     *             Please use createAndRegisterIdBroker() instead.
-     */
-    @Deprecated
-    public synchronized boolean startIdBroker()
-    {
-        return createAndRegisterIdBroker();
-    }
-
-    /**
-     * Creates the IDBroker for this Database and registers it with Torque.
-     * so it is either started instantly if Torque is already initialized
-     * or it is started when Torque is initialized.
-     * The information about the IdTable is stored in the databaseMap.
-     * If an IDBroker already exists for this Database, the method
-     * does nothing.
-     *
-     * @return true if a new IDBroker was created, false otherwise.
-     */
-    public synchronized boolean createAndRegisterIdBroker()
-    {
-        if (idBroker != null)
-        {
-            return false;
-        }
-        setIdTable("ID_TABLE");
-        TableMap tMap = getIdTable();
-        ColumnMap idTableId = new ColumnMap("QUANTITY", tMap);
-        idTableId.setType(Integer.valueOf(0));
-        idTableId.setPrimaryKey(true);
-        tMap.addColumn(idTableId);
-        ColumnMap tableName = new ColumnMap("TABLE_NAME", tMap);
-        tableName.setType("");
-        tMap.addColumn(tableName);
-        ColumnMap nextId = new ColumnMap("NEXT_ID", tMap);
-        nextId.setType(Integer.valueOf(0));
-        tMap.addColumn(nextId);
-        ColumnMap quantity = new ColumnMap("QUANTITY", tMap);
-        quantity.setType(Integer.valueOf(0));
-        tMap.addColumn(quantity);
-        idBroker = new IDBroker(this);
-        addIdGenerator(IDMethod.ID_BROKER, idBroker);
-        return true;
-    }
-
-    /**
-     * Returns the IdGenerator of the given type for this Database.
-     *
-     * @param type The type (i.e.name) of the IdGenerator.
-     *
-     * @return The IdGenerator of the requested type, or null if no IdGenerator
-     *         exists for the requested type.
-     */
-    public IdGenerator getIdGenerator(IDMethod type)
-    {
-        return idGenerators.get(type);
-    }
-
-    /**
-     * Adds an IdGenerator to the database.
-     *
-     * @param type The type of the IdGenerator.
-     * @param idGen The new IdGenerator for the type, or null
-     *        to remove the IdGenerator of the given type.
-     */
-    public void addIdGenerator(IDMethod type, IdGenerator idGen)
-    {
-        idGenerators.put(type, idGen);
-    }
-
-    /**
-     * Returns the database schema for this Database.
-     *
-     * @return the database schema for this database, or null if no schema
-     *         has been set.
-     */
-    public String getSchema()
-    {
-        return schema;
-    }
-
-    /**
-     * Sets the schema for this database.
-     *
-     * @param schema the name of the database schema to set, or null to remove
-     *        the current schema.
-     */
-    public void setSchema(String schema)
-    {
-        this.schema = schema;
-    }
-}
+package org.apache.torque;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.adapter.IDMethod;
+import org.apache.torque.dsfactory.DataSourceFactory;
+import org.apache.torque.map.ColumnMap;
+import org.apache.torque.map.DatabaseMap;
+import org.apache.torque.map.TableMap;
+import org.apache.torque.oid.IDBroker;
+import org.apache.torque.oid.IdGenerator;
+
+/**
+ * Bundles all information about a database. This includes the database adapter,
+ * the database Map and the Data Source Factory.
+ */
+public class Database
+{
+    /**
+     * The name of the database.
+     */
+    private final String name;
+
+    /**
+     * The Database adapter which encapsulates database-specific peculiarities.
+     */
+    private Adapter adapter;
+
+    /**
+     * The Map of this database.
+     */
+    private DatabaseMap databaseMap;
+
+    /**
+     * The DataSourceFactory to obtain connections to this database.
+     */
+    private DataSourceFactory dataSourceFactory;
+
+    /** The Schema name of this database, may be null if not set. */
+    private String schema = null;
+
+    /**
+     * A special table used to generate primary keys for the other tables.
+     */
+    private TableMap idTable = null;
+
+    /** The IDBroker that goes with the idTable. */
+    private IDBroker idBroker = null;
+
+    /** The IdGenerators, keyed by type of idMethod. */
+    private final Map<IDMethod, IdGenerator> idGenerators
+        = new HashMap<IDMethod, IdGenerator>();
+
+    /**
+     * Creates a new Database with the given name.
+     *
+     * @param name the name of the database, not null.
+     *
+     * @throws NullPointerException if name is null.
+     */
+    Database(String name)
+    {
+        if (name == null)
+        {
+            throw new NullPointerException("name is null");
+        }
+        this.name = name;
+    }
+
+    /**
+     * Rturns the name of the database.
+     *
+     * @return the name of the database, not null.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * Returns the adapter to this database.
+     *
+     * @return the adapter to this database, or null if no adapter is set.
+     */
+    public Adapter getAdapter()
+    {
+        return adapter;
+    }
+
+    /**
+     * Sets the adapter for this database.
+     *
+     * @param anAdapter The adapter for this database, or null to remove the
+     *        current adapter from this database.
+     */
+    public void setAdapter(Adapter anAdapter)
+    {
+        this.adapter = anAdapter;
+    }
+
+    /**
+     * Returns the database map for this database.
+     * If the database map does not exist yet, it is created by this method.
+     */
+    public synchronized DatabaseMap getDatabaseMap()
+    {
+        if (databaseMap == null)
+        {
+            databaseMap = new DatabaseMap(this);
+        }
+        return databaseMap;
+    }
+
+    /**
+     * Returns the DataSourceFactory for this database.
+     * The DataSourceFactory is responsible to create connections
+     * to this database.
+     *
+     * @return the DataSourceFactory for this database, or null if no
+     *         DataSourceFactory exists for this database.
+     */
+    public DataSourceFactory getDataSourceFactory()
+    {
+        return dataSourceFactory;
+    }
+
+    /**
+     * Sets the DataSourceFactory for this database.
+     * The DataSourceFactory is responsible to create connections
+     * to this database.
+     *
+     * @param aDataSourceFactory The new DataSorceFactory for this database,
+     *        or null to remove the current DataSourceFactory.
+     */
+    public void setDataSourceFactory(DataSourceFactory aDataSourceFactory)
+    {
+        this.dataSourceFactory = aDataSourceFactory;
+    }
+
+    /**
+     * Get the ID table for this database.
+     *
+     * @return A TableMap, or null if not yet initialized or no id table exists
+     *         for this database.
+     */
+    public TableMap getIdTable()
+    {
+        return idTable;
+    }
+
+    /**
+     * Set the ID table for this database.
+     *
+     * @param idTable The TableMap representation for the ID table.
+     */
+    public void setIdTable(TableMap idTable)
+    {
+        this.idTable = idTable;
+        getDatabaseMap().setIdTable(idTable);
+    }
+
+    /**
+     * Set the ID table for this database.
+     *
+     * @param tableName The name for the ID table.
+     */
+    public void setIdTable(String tableName)
+    {
+        TableMap tmap = new TableMap(tableName, getDatabaseMap());
+        setIdTable(tmap);
+    }
+
+    /**
+     * Get the IDBroker for this database.
+     *
+     * @return The IDBroker for this database, or null if no IdBroker has
+     *         been started for this database.
+     */
+    public IDBroker getIdBroker()
+    {
+        return idBroker;
+    }
+
+    /**
+     * Creates the IDBroker for this Database and registers it with Torque.
+     * so it is either started instantly if Torque is already initialized
+     * or it is started when Torque is initialized.
+     * The information about the IdTable is stored in the databaseMap.
+     * If an IDBroker already exists for this Database, the method
+     * does nothing.
+     *
+     * @return true if a new IDBroker was created, false otherwise.
+     *
+     * @deprecated This method will be removed in a future version of Torque.
+     *             Please use createAndRegisterIdBroker() instead.
+     */
+    @Deprecated
+    public synchronized boolean startIdBroker()
+    {
+        return createAndRegisterIdBroker();
+    }
+
+    /**
+     * Creates the IDBroker for this Database and registers it with Torque.
+     * so it is either started instantly if Torque is already initialized
+     * or it is started when Torque is initialized.
+     * The information about the IdTable is stored in the databaseMap.
+     * If an IDBroker already exists for this Database, the method
+     * does nothing.
+     *
+     * @return true if a new IDBroker was created, false otherwise.
+     */
+    public synchronized boolean createAndRegisterIdBroker()
+    {
+        if (idBroker != null)
+        {
+            return false;
+        }
+        setIdTable("ID_TABLE");
+        TableMap tMap = getIdTable();
+        ColumnMap idTableId = new ColumnMap("QUANTITY", tMap);
+        idTableId.setType(Integer.valueOf(0));
+        idTableId.setPrimaryKey(true);
+        tMap.addColumn(idTableId);
+        ColumnMap tableName = new ColumnMap("TABLE_NAME", tMap);
+        tableName.setType("");
+        tMap.addColumn(tableName);
+        ColumnMap nextId = new ColumnMap("NEXT_ID", tMap);
+        nextId.setType(Integer.valueOf(0));
+        tMap.addColumn(nextId);
+        ColumnMap quantity = new ColumnMap("QUANTITY", tMap);
+        quantity.setType(Integer.valueOf(0));
+        tMap.addColumn(quantity);
+        idBroker = new IDBroker(this);
+        addIdGenerator(IDMethod.ID_BROKER, idBroker);
+        return true;
+    }
+
+    /**
+     * Returns the IdGenerator of the given type for this Database.
+     *
+     * @param type The type (i.e.name) of the IdGenerator.
+     *
+     * @return The IdGenerator of the requested type, or null if no IdGenerator
+     *         exists for the requested type.
+     */
+    public IdGenerator getIdGenerator(IDMethod type)
+    {
+        return idGenerators.get(type);
+    }
+
+    /**
+     * Adds an IdGenerator to the database.
+     *
+     * @param type The type of the IdGenerator.
+     * @param idGen The new IdGenerator for the type, or null
+     *        to remove the IdGenerator of the given type.
+     */
+    public void addIdGenerator(IDMethod type, IdGenerator idGen)
+    {
+        idGenerators.put(type, idGen);
+    }
+
+    /**
+     * Returns the database schema for this Database.
+     *
+     * @return the database schema for this database, or null if no schema
+     *         has been set.
+     */
+    public String getSchema()
+    {
+        return schema;
+    }
+
+    /**
+     * Sets the schema for this database.
+     *
+     * @param schema the name of the database schema to set, or null to remove
+     *        the current schema.
+     */
+    public void setSchema(String schema)
+    {
+        this.schema = schema;
+    }
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/Database.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/DeadlockException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/OptimisticLockingFailedException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java Wed Feb 20 21:06:35 2013
@@ -1,240 +1,240 @@
-package org.apache.torque.adapter;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.sql.Query;
-
-/**
- * This class is the abstract base for any database adapter
- * Support for new databases is added by subclassing this
- * class and implementing its abstract methods, and by
- * registering the new database adapter and its corresponding
- * JDBC driver in the service configuration file.
- *
- * <p>The Torque database adapters exist to present a uniform
- * interface to database access across all available databases.  Once
- * the necessary adapters have been written and configured,
- * transparent swapping of databases is theoretically supported with
- * <i>zero code changes</i> and minimal configuration file
- * modifications.
- *
- * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
- * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
- * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @author <a href="mailto:vido@ldh.org">Augustin Vidovic</a>
- * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
- * @version $Id$
- */
-public abstract class AbstractAdapter implements Adapter
-{
-    /** Serial version UID. */
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Empty constructor.
-     */
-    protected AbstractAdapter()
-    {
-        // empty
-    }
-
-    /**
-     * Wraps the input string in a database function to change it to upper case.
-     *
-     * @param in The string to transform to upper case, may be a literal string,
-     *        a prepared statement replacement placeholder(*) or any other
-     *        database expression.
-     *
-     * @return The wrapped input string, so that the database evaluates the
-     *         returned expression to the upper case of the input.
-     */
-    public abstract String toUpperCase(String in);
-
-    /**
-     * Returns the character used to indicate the beginning and end of
-     * a piece of text used in a SQL statement (generally a single
-     * quote).
-     *
-     * @return The text delimiter.
-     */
-    public char getStringDelimiter()
-    {
-        return '\'';
-    }
-
-    /**
-     * Returns the constant from the {@link
-     * org.apache.torque.adapter.IDMethod} interface denoting which
-     * type of primary key generation method this type of RDBMS uses.
-     *
-     * @return IDMethod constant
-     */
-    public abstract IDMethod getIDMethodType();
-
-    /**
-     * Returns SQL used to get the most recently inserted primary key.
-     * Databases which have no support for this return
-     * <code>null</code>.
-     *
-     * @param obj Information used for key generation.
-     * @return The most recently inserted database key.
-     */
-    public abstract String getIDMethodSQL(Object obj);
-
-    /**
-     * Locks the specified table.
-     *
-     * @param con The JDBC connection to use.
-     * @param table The name of the table to lock.
-     *
-     * @throws SQLException No Statement could be created or executed.
-     */
-    public abstract void lockTable(Connection con, String table)
-            throws SQLException;
-
-    /**
-     * Unlocks the specified table.
-     *
-     * @param con The JDBC connection to use.
-     * @param table The name of the table to unlock.
-     *
-     * @throws SQLException No Statement could be created or executed.
-     */
-    public abstract void unlockTable(Connection con, String table)
-            throws SQLException;
-
-    /**
-     * Wraps the input string in a database function to change it to
-     * a case-insensitive representation.
-     *
-     * @param in The string to transform to a case-insensitive representation,
-     *        may be a literal string, a prepared statement replacement
-     *        placeholder(*) or any other database expression.
-     *
-     * @return The wrapped input string, so that the database evaluates the
-     *         returned expression to a case-insensitive representation
-     *         of the input.
-     */
-    public abstract String ignoreCase(String in);
-
-    /**
-     * This method is used to ignore case in an ORDER BY clause.
-     * Usually it is the same as ignoreCase, but some databases
-     * (hsqldb for example) do not use the same SQL in ORDER BY
-     * and other clauses.
-     *
-     * @param in The string whose case to ignore.
-     *
-     * @return The string in a case that can be ignored.
-     */
-    public String ignoreCaseInOrderBy(String in)
-    {
-        return ignoreCase(in);
-    }
-
-    /**
-     * Returns whether the database can natively limit the size of the ResultSet
-     * of a query.
-     *
-     * @return true if the database natively supports limiting the
-     *         size of the resultset.
-     */
-    public boolean supportsNativeLimit()
-    {
-        return false;
-    }
-
-    /**
-     * Returns whether the database natively supports returning results
-     * starting at an offset position other than 0.
-     *
-     * @return true if the database natively supports returning
-     *         results starting at an offset position other than 0.
-     */
-    public boolean supportsNativeOffset()
-    {
-        return false;
-    }
-
-    /**
-     * This method is used to generate the database specific query
-     * extension to limit the number of record returned.
-     *
-     * @param query The query to modify
-     * @param offset the offset Value
-     * @param limit the limit Value
-     *
-     * @throws TorqueException if any error occurs when building the query
-     */
-    public void generateLimits(Query query, long offset, int limit)
-        throws TorqueException
-    {
-        if (supportsNativeLimit())
-        {
-            query.setLimit(String.valueOf(limit));
-        }
-    }
-
-    /**
-    * This method is for the SqlExpression.quoteAndEscape rules.  The rule is,
-    * any string in a SqlExpression with a BACKSLASH will either be changed to
-    * "\\" or left as "\".
-    *
-    * @return true if the database needs to escape text in SqlExpressions.
-    */
-
-    public boolean escapeText()
-    {
-        return true;
-    }
-
-    /**
-     * Whether ILIKE should be used for case insensitive like clauses.
-     *
-     * As most databases do not use ILIKE, this implementation returns false.
-     * This behaviour may be overwritten in subclasses.
-     *
-     * @return true if ilike should be used for case insensitive likes,
-     *         false if ignoreCase should be applied to the compared strings.
-     */
-    public boolean useIlike()
-    {
-        return false;
-    }
-
-    /**
-     * Whether an escape clause in like should be used.
-     * Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\';
-     *
-     * As most databases do not need the escape clause, this implementation
-     * always returns <code>false</code>. This behaviour can be overwritten
-     * in subclasses.
-     *
-     * @return whether the escape clause should be appended or not.
-     */
-    public boolean useEscapeClauseForLike()
-    {
-        return false;
-    }
-}
+package org.apache.torque.adapter;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.sql.Query;
+
+/**
+ * This class is the abstract base for any database adapter
+ * Support for new databases is added by subclassing this
+ * class and implementing its abstract methods, and by
+ * registering the new database adapter and its corresponding
+ * JDBC driver in the service configuration file.
+ *
+ * <p>The Torque database adapters exist to present a uniform
+ * interface to database access across all available databases.  Once
+ * the necessary adapters have been written and configured,
+ * transparent swapping of databases is theoretically supported with
+ * <i>zero code changes</i> and minimal configuration file
+ * modifications.
+ *
+ * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
+ * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
+ * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
+ * @author <a href="mailto:vido@ldh.org">Augustin Vidovic</a>
+ * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
+ * @version $Id$
+ */
+public abstract class AbstractAdapter implements Adapter
+{
+    /** Serial version UID. */
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Empty constructor.
+     */
+    protected AbstractAdapter()
+    {
+        // empty
+    }
+
+    /**
+     * Wraps the input string in a database function to change it to upper case.
+     *
+     * @param in The string to transform to upper case, may be a literal string,
+     *        a prepared statement replacement placeholder(*) or any other
+     *        database expression.
+     *
+     * @return The wrapped input string, so that the database evaluates the
+     *         returned expression to the upper case of the input.
+     */
+    public abstract String toUpperCase(String in);
+
+    /**
+     * Returns the character used to indicate the beginning and end of
+     * a piece of text used in a SQL statement (generally a single
+     * quote).
+     *
+     * @return The text delimiter.
+     */
+    public char getStringDelimiter()
+    {
+        return '\'';
+    }
+
+    /**
+     * Returns the constant from the {@link
+     * org.apache.torque.adapter.IDMethod} interface denoting which
+     * type of primary key generation method this type of RDBMS uses.
+     *
+     * @return IDMethod constant
+     */
+    public abstract IDMethod getIDMethodType();
+
+    /**
+     * Returns SQL used to get the most recently inserted primary key.
+     * Databases which have no support for this return
+     * <code>null</code>.
+     *
+     * @param obj Information used for key generation.
+     * @return The most recently inserted database key.
+     */
+    public abstract String getIDMethodSQL(Object obj);
+
+    /**
+     * Locks the specified table.
+     *
+     * @param con The JDBC connection to use.
+     * @param table The name of the table to lock.
+     *
+     * @throws SQLException No Statement could be created or executed.
+     */
+    public abstract void lockTable(Connection con, String table)
+            throws SQLException;
+
+    /**
+     * Unlocks the specified table.
+     *
+     * @param con The JDBC connection to use.
+     * @param table The name of the table to unlock.
+     *
+     * @throws SQLException No Statement could be created or executed.
+     */
+    public abstract void unlockTable(Connection con, String table)
+            throws SQLException;
+
+    /**
+     * Wraps the input string in a database function to change it to
+     * a case-insensitive representation.
+     *
+     * @param in The string to transform to a case-insensitive representation,
+     *        may be a literal string, a prepared statement replacement
+     *        placeholder(*) or any other database expression.
+     *
+     * @return The wrapped input string, so that the database evaluates the
+     *         returned expression to a case-insensitive representation
+     *         of the input.
+     */
+    public abstract String ignoreCase(String in);
+
+    /**
+     * This method is used to ignore case in an ORDER BY clause.
+     * Usually it is the same as ignoreCase, but some databases
+     * (hsqldb for example) do not use the same SQL in ORDER BY
+     * and other clauses.
+     *
+     * @param in The string whose case to ignore.
+     *
+     * @return The string in a case that can be ignored.
+     */
+    public String ignoreCaseInOrderBy(String in)
+    {
+        return ignoreCase(in);
+    }
+
+    /**
+     * Returns whether the database can natively limit the size of the ResultSet
+     * of a query.
+     *
+     * @return true if the database natively supports limiting the
+     *         size of the resultset.
+     */
+    public boolean supportsNativeLimit()
+    {
+        return false;
+    }
+
+    /**
+     * Returns whether the database natively supports returning results
+     * starting at an offset position other than 0.
+     *
+     * @return true if the database natively supports returning
+     *         results starting at an offset position other than 0.
+     */
+    public boolean supportsNativeOffset()
+    {
+        return false;
+    }
+
+    /**
+     * This method is used to generate the database specific query
+     * extension to limit the number of record returned.
+     *
+     * @param query The query to modify
+     * @param offset the offset Value
+     * @param limit the limit Value
+     *
+     * @throws TorqueException if any error occurs when building the query
+     */
+    public void generateLimits(Query query, long offset, int limit)
+        throws TorqueException
+    {
+        if (supportsNativeLimit())
+        {
+            query.setLimit(String.valueOf(limit));
+        }
+    }
+
+    /**
+    * This method is for the SqlExpression.quoteAndEscape rules.  The rule is,
+    * any string in a SqlExpression with a BACKSLASH will either be changed to
+    * "\\" or left as "\".
+    *
+    * @return true if the database needs to escape text in SqlExpressions.
+    */
+
+    public boolean escapeText()
+    {
+        return true;
+    }
+
+    /**
+     * Whether ILIKE should be used for case insensitive like clauses.
+     *
+     * As most databases do not use ILIKE, this implementation returns false.
+     * This behaviour may be overwritten in subclasses.
+     *
+     * @return true if ilike should be used for case insensitive likes,
+     *         false if ignoreCase should be applied to the compared strings.
+     */
+    public boolean useIlike()
+    {
+        return false;
+    }
+
+    /**
+     * Whether an escape clause in like should be used.
+     * Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\';
+     *
+     * As most databases do not need the escape clause, this implementation
+     * always returns <code>false</code>. This behaviour can be overwritten
+     * in subclasses.
+     *
+     * @return whether the escape clause should be appended or not.
+     */
+    public boolean useEscapeClauseForLike()
+    {
+        return false;
+    }
+}

Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/adapter/AbstractAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org