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 [6/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...
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectOrColumnPsPartBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectOrColumnPsPartBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectOrColumnPsPartBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectOrColumnPsPartBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,125 +1,125 @@
-package org.apache.torque.sql.objectbuilder;
-
-/*
- * 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 org.apache.torque.Column;
-import org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.Criteria;
-import org.apache.torque.criteria.PreparedStatementPart;
-import org.apache.torque.criteria.SqlEnum;
-import org.apache.torque.om.ObjectKey;
-import org.apache.torque.sql.Query;
-import org.apache.torque.sql.SqlBuilder;
-
-/**
- * Builds a PreparedStatementPart from a column or single value.
- *
- * @version $Id$
- */
-public class ObjectOrColumnPsPartBuilder implements ObjectPsPartBuilder
-{
- /**
- * Builds a PreparedStatementPart from a column or single value.
- *
- * @param toBuildFrom the object to build the psPart from.
- * @param ignoreCase If true and columns represent Strings, the appropriate
- * function defined for the database will be used to ignore
- * differences in case.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return the PreparedStatementPart for the object.
- *
- * @throws TorqueException when rendering fails.
- */
- public PreparedStatementPart buildPs(
- Object toBuildFrom,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException
- {
- PreparedStatementPart result = new PreparedStatementPart();
- if (toBuildFrom instanceof Column)
- {
- Column column = (Column) toBuildFrom;
- if (ignoreCase)
- {
- result.getSql().append(
- adapter.ignoreCase(column.getSqlExpression()));
- }
- else
- {
- result.getSql().append(column.getSqlExpression());
- }
- return result;
- }
-
- // plain object
-
- if (toBuildFrom instanceof Criteria)
- {
- Query subquery = SqlBuilder.buildQuery(
- (Criteria) toBuildFrom);
- result.getPreparedStatementReplacements().addAll(
- subquery.getPreparedStatementReplacements());
- result.getSql().append("(").append(subquery.toString()).append(")");
- return result;
- }
-
- if (toBuildFrom instanceof org.apache.torque.util.Criteria)
- {
- Query subquery = SqlBuilder.buildQuery(
- (org.apache.torque.util.Criteria) toBuildFrom);
- result.getPreparedStatementReplacements().addAll(
- subquery.getPreparedStatementReplacements());
- result.getSql().append("(").append(subquery.toString()).append(")");
- return result;
- }
-
- if (toBuildFrom.equals(
- SqlEnum.CURRENT_DATE)
- || toBuildFrom.equals(
- SqlEnum.CURRENT_TIME)
- || toBuildFrom.equals(
- SqlEnum.CURRENT_TIMESTAMP))
- {
- result.getSql().append(toBuildFrom.toString());
- return result;
- }
- // If rValue is an ObjectKey, take the value of that ObjectKey.
- if (toBuildFrom instanceof ObjectKey)
- {
- toBuildFrom = ((ObjectKey) toBuildFrom).getValue();
- }
-
- // handle ignoreCase
- if (ignoreCase && toBuildFrom instanceof String)
- {
- result.getSql().append(adapter.ignoreCase("?"));
- }
- else
- {
- result.getSql().append("?");
- }
- result.getPreparedStatementReplacements().add(toBuildFrom);
- return result;
- }
-}
+package org.apache.torque.sql.objectbuilder;
+
+/*
+ * 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 org.apache.torque.Column;
+import org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.Criteria;
+import org.apache.torque.criteria.PreparedStatementPart;
+import org.apache.torque.criteria.SqlEnum;
+import org.apache.torque.om.ObjectKey;
+import org.apache.torque.sql.Query;
+import org.apache.torque.sql.SqlBuilder;
+
+/**
+ * Builds a PreparedStatementPart from a column or single value.
+ *
+ * @version $Id$
+ */
+public class ObjectOrColumnPsPartBuilder implements ObjectPsPartBuilder
+{
+ /**
+ * Builds a PreparedStatementPart from a column or single value.
+ *
+ * @param toBuildFrom the object to build the psPart from.
+ * @param ignoreCase If true and columns represent Strings, the appropriate
+ * function defined for the database will be used to ignore
+ * differences in case.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return the PreparedStatementPart for the object.
+ *
+ * @throws TorqueException when rendering fails.
+ */
+ public PreparedStatementPart buildPs(
+ Object toBuildFrom,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException
+ {
+ PreparedStatementPart result = new PreparedStatementPart();
+ if (toBuildFrom instanceof Column)
+ {
+ Column column = (Column) toBuildFrom;
+ if (ignoreCase)
+ {
+ result.getSql().append(
+ adapter.ignoreCase(column.getSqlExpression()));
+ }
+ else
+ {
+ result.getSql().append(column.getSqlExpression());
+ }
+ return result;
+ }
+
+ // plain object
+
+ if (toBuildFrom instanceof Criteria)
+ {
+ Query subquery = SqlBuilder.buildQuery(
+ (Criteria) toBuildFrom);
+ result.getPreparedStatementReplacements().addAll(
+ subquery.getPreparedStatementReplacements());
+ result.getSql().append("(").append(subquery.toString()).append(")");
+ return result;
+ }
+
+ if (toBuildFrom instanceof org.apache.torque.util.Criteria)
+ {
+ Query subquery = SqlBuilder.buildQuery(
+ (org.apache.torque.util.Criteria) toBuildFrom);
+ result.getPreparedStatementReplacements().addAll(
+ subquery.getPreparedStatementReplacements());
+ result.getSql().append("(").append(subquery.toString()).append(")");
+ return result;
+ }
+
+ if (toBuildFrom.equals(
+ SqlEnum.CURRENT_DATE)
+ || toBuildFrom.equals(
+ SqlEnum.CURRENT_TIME)
+ || toBuildFrom.equals(
+ SqlEnum.CURRENT_TIMESTAMP))
+ {
+ result.getSql().append(toBuildFrom.toString());
+ return result;
+ }
+ // If rValue is an ObjectKey, take the value of that ObjectKey.
+ if (toBuildFrom instanceof ObjectKey)
+ {
+ toBuildFrom = ((ObjectKey) toBuildFrom).getValue();
+ }
+
+ // handle ignoreCase
+ if (ignoreCase && toBuildFrom instanceof String)
+ {
+ result.getSql().append(adapter.ignoreCase("?"));
+ }
+ else
+ {
+ result.getSql().append("?");
+ }
+ result.getPreparedStatementReplacements().add(toBuildFrom);
+ return result;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectOrColumnPsPartBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectPsPartBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectPsPartBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectPsPartBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectPsPartBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,53 +1,53 @@
-package org.apache.torque.sql.objectbuilder;
-
-/*
- * 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 org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.PreparedStatementPart;
-
-/**
- * Builds a PreparedStatementPart from a single object
- * (e.g. a column or a SQL value).
- *
- * @version $Id$
- */
-public interface ObjectPsPartBuilder
-{
- /**
- * Builds a PreparedStatementPart from a single Object.
- *
- * @param toBuildFrom the object to build the psPart from.
- * @param ignoreCase If true and columns represent Strings, the appropriate
- * function defined for the database will be used to ignore
- * differences in case.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return the PreparedStatementPart for the object.
- *
- * @throws TorqueException when rendering fails.
- */
- PreparedStatementPart buildPs(
- Object toBuildFrom,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException;
-}
+package org.apache.torque.sql.objectbuilder;
+
+/*
+ * 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 org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.PreparedStatementPart;
+
+/**
+ * Builds a PreparedStatementPart from a single object
+ * (e.g. a column or a SQL value).
+ *
+ * @version $Id$
+ */
+public interface ObjectPsPartBuilder
+{
+ /**
+ * Builds a PreparedStatementPart from a single Object.
+ *
+ * @param toBuildFrom the object to build the psPart from.
+ * @param ignoreCase If true and columns represent Strings, the appropriate
+ * function defined for the database will be used to ignore
+ * differences in case.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return the PreparedStatementPart for the object.
+ *
+ * @throws TorqueException when rendering fails.
+ */
+ PreparedStatementPart buildPs(
+ Object toBuildFrom,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException;
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/ObjectPsPartBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/package.html?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/package.html (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/package.html Wed Feb 20 21:06:35 2013
@@ -1,26 +1,26 @@
-<!--
- 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.
--->
-<html>
- <head>
- </head>
- <body>
- This package contains classes which can build
- PreparedStatementParts from a single value or column.
- </body>
-</html>
+<!--
+ 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.
+-->
+<html>
+ <head>
+ </head>
+ <body>
+ This package contains classes which can build
+ PreparedStatementParts from a single value or column.
+ </body>
+</html>
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/objectbuilder/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/package.html?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/package.html (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/package.html Wed Feb 20 21:06:35 2013
@@ -1,28 +1,28 @@
-<!--
- 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.
--->
-<html>
- <head>
- </head>
- <body>
- This package contains classes which are mainly used in the SQL generation
- process.
- These classes are NOT considered part of the public API of Torque
- and may change without notice.
- </body>
-</html>
+<!--
+ 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.
+-->
+<html>
+ <head>
+ </head>
+ <body>
+ This package contains classes which are mainly used in the SQL generation
+ process.
+ These classes are NOT considered part of the public API of Torque
+ and may change without notice.
+ </body>
+</html>
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/AbstractWhereClausePsPartBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/AbstractWhereClausePsPartBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/AbstractWhereClausePsPartBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/AbstractWhereClausePsPartBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,57 +1,57 @@
-package org.apache.torque.sql.whereclausebuilder;
-
-/*
- * 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 org.apache.torque.sql.objectbuilder.ObjectOrColumnPsPartBuilder;
-import org.apache.torque.sql.objectbuilder.ObjectPsPartBuilder;
-
-/**
- * Abstract base class for a WhereClausePsPartBuilder.
- *
- * @version $Id$
- */
-public abstract class AbstractWhereClausePsPartBuilder
- implements WhereClausePsPartBuilder
-{
- /** The ObjectPsPartBuilder to use for single values or columns. */
- private static ObjectPsPartBuilder objectOrColumnPsPartBuilder
- = new ObjectOrColumnPsPartBuilder();
-
- /**
- * Returns the ObjectPsPartBuilder to use for single values or columns.
- *
- * @return the ObjectPsPartBuilder to use.
- */
- public static ObjectPsPartBuilder getObjectOrColumnPsPartBuilder()
- {
- return objectOrColumnPsPartBuilder;
- }
-
- /**
- * Set the ObjectPsPartBuilder to use for single values or columns.
- *
- * @param builder the new ObjectPsPartBuilder to use.
- */
- public static void setObjectOrColumnPsPartBuilder(
- ObjectPsPartBuilder builder)
- {
- AbstractWhereClausePsPartBuilder.objectOrColumnPsPartBuilder = builder;
- }
-}
+package org.apache.torque.sql.whereclausebuilder;
+
+/*
+ * 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 org.apache.torque.sql.objectbuilder.ObjectOrColumnPsPartBuilder;
+import org.apache.torque.sql.objectbuilder.ObjectPsPartBuilder;
+
+/**
+ * Abstract base class for a WhereClausePsPartBuilder.
+ *
+ * @version $Id$
+ */
+public abstract class AbstractWhereClausePsPartBuilder
+ implements WhereClausePsPartBuilder
+{
+ /** The ObjectPsPartBuilder to use for single values or columns. */
+ private static ObjectPsPartBuilder objectOrColumnPsPartBuilder
+ = new ObjectOrColumnPsPartBuilder();
+
+ /**
+ * Returns the ObjectPsPartBuilder to use for single values or columns.
+ *
+ * @return the ObjectPsPartBuilder to use.
+ */
+ public static ObjectPsPartBuilder getObjectOrColumnPsPartBuilder()
+ {
+ return objectOrColumnPsPartBuilder;
+ }
+
+ /**
+ * Set the ObjectPsPartBuilder to use for single values or columns.
+ *
+ * @param builder the new ObjectPsPartBuilder to use.
+ */
+ public static void setObjectOrColumnPsPartBuilder(
+ ObjectPsPartBuilder builder)
+ {
+ AbstractWhereClausePsPartBuilder.objectOrColumnPsPartBuilder = builder;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/AbstractWhereClausePsPartBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CurrentDateTimePsPartBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CurrentDateTimePsPartBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CurrentDateTimePsPartBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CurrentDateTimePsPartBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,77 +1,77 @@
-package org.apache.torque.sql.whereclausebuilder;
-
-/*
- * 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 org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.PreparedStatementPart;
-import org.apache.torque.criteria.SqlEnum;
-import org.apache.torque.sql.WhereClauseExpression;
-
-/**
- * A WhereClausePsPartBuilder which handles <code>SqlEnum.CURRENT_DATE</code>
- * and <code>SqlEnum.CURRENT_TIME</code>.
- *
- * @version $Id$
- */
-public class CurrentDateTimePsPartBuilder
- extends AbstractWhereClausePsPartBuilder
-{
- /**
- * {@inheritDoc}
- */
- public PreparedStatementPart buildPs(
- WhereClauseExpression whereClauseExpression,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException
- {
- PreparedStatementPart result
- = getObjectOrColumnPsPartBuilder().buildPs(
- whereClauseExpression.getLValue(),
- ignoreCase,
- adapter);
- result.getSql().append(whereClauseExpression.getOperator());
- result .append(getObjectOrColumnPsPartBuilder().buildPs(
- whereClauseExpression.getRValue(),
- ignoreCase,
- adapter));
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isApplicable(
- WhereClauseExpression whereClauseExpression,
- Adapter adapter)
- {
- if (whereClauseExpression.getOperator().equals(
- SqlEnum.CURRENT_DATE)
- || whereClauseExpression.getOperator().equals(
- SqlEnum.CURRENT_TIME)
- || whereClauseExpression.getOperator().equals(
- SqlEnum.CURRENT_TIMESTAMP))
- {
- return true;
- }
- return false;
- }
-}
+package org.apache.torque.sql.whereclausebuilder;
+
+/*
+ * 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 org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.PreparedStatementPart;
+import org.apache.torque.criteria.SqlEnum;
+import org.apache.torque.sql.WhereClauseExpression;
+
+/**
+ * A WhereClausePsPartBuilder which handles <code>SqlEnum.CURRENT_DATE</code>
+ * and <code>SqlEnum.CURRENT_TIME</code>.
+ *
+ * @version $Id$
+ */
+public class CurrentDateTimePsPartBuilder
+ extends AbstractWhereClausePsPartBuilder
+{
+ /**
+ * {@inheritDoc}
+ */
+ public PreparedStatementPart buildPs(
+ WhereClauseExpression whereClauseExpression,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException
+ {
+ PreparedStatementPart result
+ = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClauseExpression.getLValue(),
+ ignoreCase,
+ adapter);
+ result.getSql().append(whereClauseExpression.getOperator());
+ result .append(getObjectOrColumnPsPartBuilder().buildPs(
+ whereClauseExpression.getRValue(),
+ ignoreCase,
+ adapter));
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isApplicable(
+ WhereClauseExpression whereClauseExpression,
+ Adapter adapter)
+ {
+ if (whereClauseExpression.getOperator().equals(
+ SqlEnum.CURRENT_DATE)
+ || whereClauseExpression.getOperator().equals(
+ SqlEnum.CURRENT_TIME)
+ || whereClauseExpression.getOperator().equals(
+ SqlEnum.CURRENT_TIMESTAMP))
+ {
+ return true;
+ }
+ return false;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CurrentDateTimePsPartBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CustomBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CustomBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CustomBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CustomBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,89 +1,89 @@
-package org.apache.torque.sql.whereclausebuilder;
-
-/*
- * 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 org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.PreparedStatementPart;
-import org.apache.torque.criteria.SqlEnum;
-import org.apache.torque.sql.WhereClauseExpression;
-
-/**
- * Builds a PreparedStatementPart from a WhereClauseExpression containing
- * a <code>SqlEnum.CUSTOM</code> operator.
- *
- * @version $Id$
- */
-public class CustomBuilder implements WhereClausePsPartBuilder
-{
- /**
- * Builds the PS part for a WhereClauseExpression with a
- * <code>SqlEnum.CUSTOM</code> operator.
- * The rendered SQL contains only the RHS of the whereClauseExpression
- * as String.
- *
- * @param whereClausePart the part of the where clause to build.
- * Can be modified in this method.
- * @param ignoreCase If true and columns represent Strings, the appropriate
- * function defined for the database will be used to ignore
- * differences in case.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return the rendered SQL for the WhereClauseExpression
- */
- public PreparedStatementPart buildPs(
- WhereClauseExpression whereClausePart,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException
- {
- if (!(whereClausePart.getRValue() instanceof String))
- {
- throw new TorqueException(
- "rValue must be a String for the operator "
- + whereClausePart.getOperator());
- }
- PreparedStatementPart result = new PreparedStatementPart();
- result.getSql().append(whereClausePart.getRValue());
- return result;
- }
-
- /**
- * Returns whether this WhereClausePsPartBuilder is applicable for
- * a given WhereClauseExpression.
- *
- * @param whereClauseExpression the WhereClauseExpression in question.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return true if applicable, false otherwise.
- */
- public boolean isApplicable(
- WhereClauseExpression whereClauseExpression,
- Adapter adapter)
- {
- if (whereClauseExpression.getOperator().equals(SqlEnum.CUSTOM))
- {
- return true;
- }
- return false;
- }
-}
+package org.apache.torque.sql.whereclausebuilder;
+
+/*
+ * 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 org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.PreparedStatementPart;
+import org.apache.torque.criteria.SqlEnum;
+import org.apache.torque.sql.WhereClauseExpression;
+
+/**
+ * Builds a PreparedStatementPart from a WhereClauseExpression containing
+ * a <code>SqlEnum.CUSTOM</code> operator.
+ *
+ * @version $Id$
+ */
+public class CustomBuilder implements WhereClausePsPartBuilder
+{
+ /**
+ * Builds the PS part for a WhereClauseExpression with a
+ * <code>SqlEnum.CUSTOM</code> operator.
+ * The rendered SQL contains only the RHS of the whereClauseExpression
+ * as String.
+ *
+ * @param whereClausePart the part of the where clause to build.
+ * Can be modified in this method.
+ * @param ignoreCase If true and columns represent Strings, the appropriate
+ * function defined for the database will be used to ignore
+ * differences in case.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return the rendered SQL for the WhereClauseExpression
+ */
+ public PreparedStatementPart buildPs(
+ WhereClauseExpression whereClausePart,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException
+ {
+ if (!(whereClausePart.getRValue() instanceof String))
+ {
+ throw new TorqueException(
+ "rValue must be a String for the operator "
+ + whereClausePart.getOperator());
+ }
+ PreparedStatementPart result = new PreparedStatementPart();
+ result.getSql().append(whereClausePart.getRValue());
+ return result;
+ }
+
+ /**
+ * Returns whether this WhereClausePsPartBuilder is applicable for
+ * a given WhereClauseExpression.
+ *
+ * @param whereClauseExpression the WhereClauseExpression in question.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return true if applicable, false otherwise.
+ */
+ public boolean isApplicable(
+ WhereClauseExpression whereClauseExpression,
+ Adapter adapter)
+ {
+ if (whereClauseExpression.getOperator().equals(SqlEnum.CUSTOM))
+ {
+ return true;
+ }
+ return false;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/CustomBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/InBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/InBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/InBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/InBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,173 +1,173 @@
-package org.apache.torque.sql.whereclausebuilder;
-
-/*
- * 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.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.Criteria;
-import org.apache.torque.criteria.Criterion;
-import org.apache.torque.criteria.PreparedStatementPart;
-import org.apache.torque.criteria.SqlEnum;
-import org.apache.torque.sql.WhereClauseExpression;
-
-/**
- * Builds a PreparedStatementPart from a WhereClauseExpression containing
- * a Like operator.
- *
- * @version $Id$
- */
-public class InBuilder extends AbstractWhereClausePsPartBuilder
-{
- /**
- * Takes a columnName and criteria and
- * builds a SQL 'IN' expression taking into account the ignoreCase
- * flag.
- *
- * @param whereClausePart the part of the where clause to build.
- * Can be modified in this method.
- * @param ignoreCase If true and columns represent Strings, the appropriate
- * function defined for the database will be used to ignore
- * differences in case.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- */
- public PreparedStatementPart buildPs(
- WhereClauseExpression whereClausePart,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException
- {
- PreparedStatementPart result = new PreparedStatementPart();
-
- boolean ignoreCaseApplied = false;
- List<String> inClause = new ArrayList<String>();
- boolean nullContained = false;
- if (whereClausePart.getRValue() instanceof Iterable)
- {
- for (Object listValue : (Iterable<?>) whereClausePart.getRValue())
- {
- if (listValue == null)
- {
- nullContained = true;
- continue;
- }
- result.getPreparedStatementReplacements().add(listValue);
- if (ignoreCase && listValue instanceof String)
- {
- inClause.add(adapter.ignoreCase("?"));
- ignoreCaseApplied = true;
- }
- else
- {
- inClause.add("?");
- }
- }
- }
- else if (whereClausePart.getRValue().getClass().isArray())
- {
- for (Object arrayValue : (Object[]) whereClausePart.getRValue())
- {
- if (arrayValue == null)
- {
- nullContained = true;
- continue;
- }
- result.getPreparedStatementReplacements().add(arrayValue);
- if (ignoreCase && arrayValue instanceof String)
- {
- inClause.add(adapter.ignoreCase("?"));
- ignoreCaseApplied = true;
- }
- else
- {
- inClause.add("?");
- }
- }
- }
- else
- {
- throw new IllegalArgumentException(
- "Unknown rValue type "
- + whereClausePart.getRValue().getClass().getName()
- + ". rValue must be an instance of "
- + " Iterable or Array");
- }
-
- if (nullContained)
- {
- result.getSql().append('(');
- }
-
- result.append(getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(),
- ignoreCaseApplied,
- adapter));
-
- result.getSql().append(whereClausePart.getOperator())
- .append('(')
- .append(StringUtils.join(inClause.iterator(), ","))
- .append(')');
- if (nullContained)
- {
- if (whereClausePart.getOperator() == SqlEnum.IN)
- {
- result.getSql().append(Criterion.OR);
- result.append(getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(),
- false,
- adapter));
- result.getSql().append(SqlEnum.ISNULL);
- }
- else if (whereClausePart.getOperator() == SqlEnum.NOT_IN)
- {
- result.getSql().append(Criterion.AND);
- result.append(getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(),
- false,
- adapter));
- result.getSql().append(SqlEnum.ISNOTNULL);
- }
- result.getSql().append(')');
- }
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isApplicable(
- WhereClauseExpression whereClauseExpression,
- Adapter adapter)
- {
- if (whereClauseExpression.getOperator().equals(Criteria.IN)
- || whereClauseExpression.getOperator().equals(Criteria.NOT_IN))
- {
- if (!(whereClauseExpression.getRValue() instanceof Criteria))
- {
- return true;
- }
- }
- return false;
- }
-}
+package org.apache.torque.sql.whereclausebuilder;
+
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.Criteria;
+import org.apache.torque.criteria.Criterion;
+import org.apache.torque.criteria.PreparedStatementPart;
+import org.apache.torque.criteria.SqlEnum;
+import org.apache.torque.sql.WhereClauseExpression;
+
+/**
+ * Builds a PreparedStatementPart from a WhereClauseExpression containing
+ * a Like operator.
+ *
+ * @version $Id$
+ */
+public class InBuilder extends AbstractWhereClausePsPartBuilder
+{
+ /**
+ * Takes a columnName and criteria and
+ * builds a SQL 'IN' expression taking into account the ignoreCase
+ * flag.
+ *
+ * @param whereClausePart the part of the where clause to build.
+ * Can be modified in this method.
+ * @param ignoreCase If true and columns represent Strings, the appropriate
+ * function defined for the database will be used to ignore
+ * differences in case.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ */
+ public PreparedStatementPart buildPs(
+ WhereClauseExpression whereClausePart,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException
+ {
+ PreparedStatementPart result = new PreparedStatementPart();
+
+ boolean ignoreCaseApplied = false;
+ List<String> inClause = new ArrayList<String>();
+ boolean nullContained = false;
+ if (whereClausePart.getRValue() instanceof Iterable)
+ {
+ for (Object listValue : (Iterable<?>) whereClausePart.getRValue())
+ {
+ if (listValue == null)
+ {
+ nullContained = true;
+ continue;
+ }
+ result.getPreparedStatementReplacements().add(listValue);
+ if (ignoreCase && listValue instanceof String)
+ {
+ inClause.add(adapter.ignoreCase("?"));
+ ignoreCaseApplied = true;
+ }
+ else
+ {
+ inClause.add("?");
+ }
+ }
+ }
+ else if (whereClausePart.getRValue().getClass().isArray())
+ {
+ for (Object arrayValue : (Object[]) whereClausePart.getRValue())
+ {
+ if (arrayValue == null)
+ {
+ nullContained = true;
+ continue;
+ }
+ result.getPreparedStatementReplacements().add(arrayValue);
+ if (ignoreCase && arrayValue instanceof String)
+ {
+ inClause.add(adapter.ignoreCase("?"));
+ ignoreCaseApplied = true;
+ }
+ else
+ {
+ inClause.add("?");
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException(
+ "Unknown rValue type "
+ + whereClausePart.getRValue().getClass().getName()
+ + ". rValue must be an instance of "
+ + " Iterable or Array");
+ }
+
+ if (nullContained)
+ {
+ result.getSql().append('(');
+ }
+
+ result.append(getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(),
+ ignoreCaseApplied,
+ adapter));
+
+ result.getSql().append(whereClausePart.getOperator())
+ .append('(')
+ .append(StringUtils.join(inClause.iterator(), ","))
+ .append(')');
+ if (nullContained)
+ {
+ if (whereClausePart.getOperator() == SqlEnum.IN)
+ {
+ result.getSql().append(Criterion.OR);
+ result.append(getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(),
+ false,
+ adapter));
+ result.getSql().append(SqlEnum.ISNULL);
+ }
+ else if (whereClausePart.getOperator() == SqlEnum.NOT_IN)
+ {
+ result.getSql().append(Criterion.AND);
+ result.append(getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(),
+ false,
+ adapter));
+ result.getSql().append(SqlEnum.ISNOTNULL);
+ }
+ result.getSql().append(')');
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isApplicable(
+ WhereClauseExpression whereClauseExpression,
+ Adapter adapter)
+ {
+ if (whereClauseExpression.getOperator().equals(Criteria.IN)
+ || whereClauseExpression.getOperator().equals(Criteria.NOT_IN))
+ {
+ if (!(whereClauseExpression.getRValue() instanceof Criteria))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/InBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/LikeBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/LikeBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/LikeBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/LikeBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,225 +1,225 @@
-package org.apache.torque.sql.whereclausebuilder;
-
-/*
- * 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 org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.PreparedStatementPart;
-import org.apache.torque.criteria.SqlEnum;
-import org.apache.torque.sql.WhereClauseExpression;
-
-/**
- * Builds a PreparedStatementPart from a WhereClauseExpression containing
- * a Like operator.
- *
- * @version $Id$
- */
-public class LikeBuilder extends AbstractWhereClausePsPartBuilder
-{
- /** The backslash character*/
- private static final char BACKSLASH = '\\';
-
- /**
- * Builds the PS part for a WhereClauseExpression with a LIKE operator.
- * Multicharacter wildcards % and * may be used
- * as well as single character wildcards, _ and ?. These
- * characters can be escaped with \.
- *
- * e.g. criteria = "fre%" -> columnName LIKE 'fre%'
- * -> UPPER(columnName) LIKE UPPER('fre%')
- * criteria = "50\%" -> columnName = '50%'
- *
- * @param whereClausePart the part of the where clause to build.
- * Can be modified in this method.
- * @param ignoreCase If true and columns represent Strings, the appropriate
- * function defined for the database will be used to ignore
- * differences in case.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return the rendered SQL for the WhereClauseExpression
- */
- public PreparedStatementPart buildPs(
- WhereClauseExpression whereClausePart,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException
- {
- if (!(whereClausePart.getRValue() instanceof String))
- {
- throw new TorqueException(
- "rValue must be a String for the operator "
- + whereClausePart.getOperator());
- }
- String value = (String) whereClausePart.getRValue();
- // If selection criteria contains wildcards use LIKE otherwise
- // use = (equals). Wildcards can be escaped by prepending
- // them with \ (backslash). However, if we switch from
- // like to equals, we need to remove the escape characters.
- // from the wildcards.
- // So we need two passes: The first replaces * and ? by % and _,
- // and checks whether we switch to equals,
- // the second removes escapes if we have switched to equals.
- int position = 0;
- StringBuffer sb = new StringBuffer();
- boolean replaceWithEquals = true;
- while (position < value.length())
- {
- char checkWildcard = value.charAt(position);
-
- switch (checkWildcard)
- {
- case BACKSLASH:
- if (position + 1 >= value.length())
- {
- // ignore backslashes at end
- break;
- }
- position++;
- char escapedChar = value.charAt(position);
- if (escapedChar != '*' && escapedChar != '?')
- {
- sb.append(checkWildcard);
- }
- // code below copies escaped character into sb
- checkWildcard = escapedChar;
- break;
- case '%':
- case '_':
- replaceWithEquals = false;
- break;
- case '*':
- replaceWithEquals = false;
- checkWildcard = '%';
- break;
- case '?':
- replaceWithEquals = false;
- checkWildcard = '_';
- break;
- default:
- break;
- }
-
- sb.append(checkWildcard);
- position++;
- }
- value = sb.toString();
-
- PreparedStatementPart result;
- if (ignoreCase)
- {
- if (adapter.useIlike() && !replaceWithEquals)
- {
- if (SqlEnum.LIKE.equals(whereClausePart.getOperator()))
- {
- whereClausePart.setOperator(SqlEnum.ILIKE);
- }
- else if (SqlEnum.NOT_LIKE.equals(whereClausePart.getOperator()))
- {
- whereClausePart.setOperator(SqlEnum.NOT_ILIKE);
- }
- result = getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(), false, adapter);
- }
- else
- {
- // no native case insensitive like is offered by the DB,
- // or the LIKE was replaced with equals.
- // need to ignore case manually.
- result = getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(), true, adapter);
- }
- }
- else
- {
- result = getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(), ignoreCase, adapter);
- }
-
- if (replaceWithEquals)
- {
- if (whereClausePart.getOperator().equals(SqlEnum.NOT_LIKE)
- || whereClausePart.getOperator().equals(SqlEnum.NOT_ILIKE))
- {
- result.getSql().append(SqlEnum.NOT_EQUAL);
- }
- else
- {
- result.getSql().append(SqlEnum.EQUAL);
- }
-
- // remove escape backslashes from String
- position = 0;
- sb = new StringBuffer();
- while (position < value.length())
- {
- char checkWildcard = value.charAt(position);
-
- if (checkWildcard == BACKSLASH
- && position + 1 < value.length())
- {
- position++;
- // code below copies escaped character into sb
- checkWildcard = value.charAt(position);
- }
- sb.append(checkWildcard);
- position++;
- }
- value = sb.toString();
- }
- else
- {
- result.getSql().append(whereClausePart.getOperator());
- }
-
- String rValueSql = "?";
- // handle ignoreCase if necessary
- if (ignoreCase && (!(adapter.useIlike()) || replaceWithEquals))
- {
- rValueSql = adapter.ignoreCase(rValueSql);
- }
- // handle escape clause if necessary
- if (!replaceWithEquals && adapter.useEscapeClauseForLike())
- {
- rValueSql = rValueSql + SqlEnum.ESCAPE + "'\\'";
- }
-
- result.getPreparedStatementReplacements().add(value);
- result.getSql().append(rValueSql);
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isApplicable(
- WhereClauseExpression whereClauseExpression,
- Adapter adapter)
- {
- if (whereClauseExpression.getOperator().equals(SqlEnum.LIKE)
- || whereClauseExpression.getOperator().equals(SqlEnum.NOT_LIKE)
- || whereClauseExpression.getOperator().equals(SqlEnum.ILIKE)
- || whereClauseExpression.getOperator().equals(SqlEnum.NOT_ILIKE))
- {
- return true;
- }
- return false;
- }
-}
+package org.apache.torque.sql.whereclausebuilder;
+
+/*
+ * 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 org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.PreparedStatementPart;
+import org.apache.torque.criteria.SqlEnum;
+import org.apache.torque.sql.WhereClauseExpression;
+
+/**
+ * Builds a PreparedStatementPart from a WhereClauseExpression containing
+ * a Like operator.
+ *
+ * @version $Id$
+ */
+public class LikeBuilder extends AbstractWhereClausePsPartBuilder
+{
+ /** The backslash character*/
+ private static final char BACKSLASH = '\\';
+
+ /**
+ * Builds the PS part for a WhereClauseExpression with a LIKE operator.
+ * Multicharacter wildcards % and * may be used
+ * as well as single character wildcards, _ and ?. These
+ * characters can be escaped with \.
+ *
+ * e.g. criteria = "fre%" -> columnName LIKE 'fre%'
+ * -> UPPER(columnName) LIKE UPPER('fre%')
+ * criteria = "50\%" -> columnName = '50%'
+ *
+ * @param whereClausePart the part of the where clause to build.
+ * Can be modified in this method.
+ * @param ignoreCase If true and columns represent Strings, the appropriate
+ * function defined for the database will be used to ignore
+ * differences in case.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return the rendered SQL for the WhereClauseExpression
+ */
+ public PreparedStatementPart buildPs(
+ WhereClauseExpression whereClausePart,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException
+ {
+ if (!(whereClausePart.getRValue() instanceof String))
+ {
+ throw new TorqueException(
+ "rValue must be a String for the operator "
+ + whereClausePart.getOperator());
+ }
+ String value = (String) whereClausePart.getRValue();
+ // If selection criteria contains wildcards use LIKE otherwise
+ // use = (equals). Wildcards can be escaped by prepending
+ // them with \ (backslash). However, if we switch from
+ // like to equals, we need to remove the escape characters.
+ // from the wildcards.
+ // So we need two passes: The first replaces * and ? by % and _,
+ // and checks whether we switch to equals,
+ // the second removes escapes if we have switched to equals.
+ int position = 0;
+ StringBuffer sb = new StringBuffer();
+ boolean replaceWithEquals = true;
+ while (position < value.length())
+ {
+ char checkWildcard = value.charAt(position);
+
+ switch (checkWildcard)
+ {
+ case BACKSLASH:
+ if (position + 1 >= value.length())
+ {
+ // ignore backslashes at end
+ break;
+ }
+ position++;
+ char escapedChar = value.charAt(position);
+ if (escapedChar != '*' && escapedChar != '?')
+ {
+ sb.append(checkWildcard);
+ }
+ // code below copies escaped character into sb
+ checkWildcard = escapedChar;
+ break;
+ case '%':
+ case '_':
+ replaceWithEquals = false;
+ break;
+ case '*':
+ replaceWithEquals = false;
+ checkWildcard = '%';
+ break;
+ case '?':
+ replaceWithEquals = false;
+ checkWildcard = '_';
+ break;
+ default:
+ break;
+ }
+
+ sb.append(checkWildcard);
+ position++;
+ }
+ value = sb.toString();
+
+ PreparedStatementPart result;
+ if (ignoreCase)
+ {
+ if (adapter.useIlike() && !replaceWithEquals)
+ {
+ if (SqlEnum.LIKE.equals(whereClausePart.getOperator()))
+ {
+ whereClausePart.setOperator(SqlEnum.ILIKE);
+ }
+ else if (SqlEnum.NOT_LIKE.equals(whereClausePart.getOperator()))
+ {
+ whereClausePart.setOperator(SqlEnum.NOT_ILIKE);
+ }
+ result = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(), false, adapter);
+ }
+ else
+ {
+ // no native case insensitive like is offered by the DB,
+ // or the LIKE was replaced with equals.
+ // need to ignore case manually.
+ result = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(), true, adapter);
+ }
+ }
+ else
+ {
+ result = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(), ignoreCase, adapter);
+ }
+
+ if (replaceWithEquals)
+ {
+ if (whereClausePart.getOperator().equals(SqlEnum.NOT_LIKE)
+ || whereClausePart.getOperator().equals(SqlEnum.NOT_ILIKE))
+ {
+ result.getSql().append(SqlEnum.NOT_EQUAL);
+ }
+ else
+ {
+ result.getSql().append(SqlEnum.EQUAL);
+ }
+
+ // remove escape backslashes from String
+ position = 0;
+ sb = new StringBuffer();
+ while (position < value.length())
+ {
+ char checkWildcard = value.charAt(position);
+
+ if (checkWildcard == BACKSLASH
+ && position + 1 < value.length())
+ {
+ position++;
+ // code below copies escaped character into sb
+ checkWildcard = value.charAt(position);
+ }
+ sb.append(checkWildcard);
+ position++;
+ }
+ value = sb.toString();
+ }
+ else
+ {
+ result.getSql().append(whereClausePart.getOperator());
+ }
+
+ String rValueSql = "?";
+ // handle ignoreCase if necessary
+ if (ignoreCase && (!(adapter.useIlike()) || replaceWithEquals))
+ {
+ rValueSql = adapter.ignoreCase(rValueSql);
+ }
+ // handle escape clause if necessary
+ if (!replaceWithEquals && adapter.useEscapeClauseForLike())
+ {
+ rValueSql = rValueSql + SqlEnum.ESCAPE + "'\\'";
+ }
+
+ result.getPreparedStatementReplacements().add(value);
+ result.getSql().append(rValueSql);
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isApplicable(
+ WhereClauseExpression whereClauseExpression,
+ Adapter adapter)
+ {
+ if (whereClauseExpression.getOperator().equals(SqlEnum.LIKE)
+ || whereClauseExpression.getOperator().equals(SqlEnum.NOT_LIKE)
+ || whereClauseExpression.getOperator().equals(SqlEnum.ILIKE)
+ || whereClauseExpression.getOperator().equals(SqlEnum.NOT_ILIKE))
+ {
+ return true;
+ }
+ return false;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/LikeBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/NullValueBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/NullValueBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/NullValueBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/NullValueBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,126 +1,126 @@
-package org.apache.torque.sql.whereclausebuilder;
-
-/*
- * 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 org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.PreparedStatementPart;
-import org.apache.torque.criteria.SqlEnum;
-import org.apache.torque.om.ObjectKey;
-import org.apache.torque.sql.WhereClauseExpression;
-
-/**
- * Builds a PreparedStatementPart from a WhereClauseExpression which
- * rhs is null and which has one of the comparison opertator =, <>, or !=,
- * or which operator is SqlEnum.ISNULL or SqlEnum.ISNOTNULL
-
- *
- * @version $Id$
- */
-public class NullValueBuilder extends AbstractWhereClausePsPartBuilder
-{
- /**
- * Builds a PreparedStatementPart from a WhereClauseExpression which
- * rhs is null and which has one of the comparison opertator =, <>, or !=.
- *
- * @param whereClausePart the part of the where clause to build.
- * Can be modified in this method.
- * @param ignoreCase If true and columns represent Strings, the appropriate
- * function defined for the database will be used to ignore
- * differences in case.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return the rendered SQL for the WhereClauseExpression
- */
- public PreparedStatementPart buildPs(
- WhereClauseExpression whereClausePart,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException
- {
- PreparedStatementPart result;
- if (whereClausePart.getOperator().equals(SqlEnum.ISNULL)
- || whereClausePart.getOperator().equals(SqlEnum.ISNOTNULL))
- {
- result = getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(), ignoreCase, adapter);
- result.getSql().append(whereClausePart.getOperator());
- return result;
- }
-
- // now we know from isApplicable() that rValue is null or is
- // an ObjectKey containing null
- if (whereClausePart.getOperator().equals(SqlEnum.EQUAL))
- {
- result = getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(), ignoreCase, adapter);
- result.getSql().append(SqlEnum.ISNULL);
- return result;
- }
- if (whereClausePart.getOperator().equals(SqlEnum.NOT_EQUAL)
- || whereClausePart.getOperator().equals(
- SqlEnum.ALT_NOT_EQUAL))
- {
- result = getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(), ignoreCase, adapter);
- result.getSql().append(SqlEnum.ISNOTNULL);
- return result;
- }
- throw new IllegalStateException("unknown operator "
- + whereClausePart.getOperator());
- }
-
- /**
- * Returns whether this WhereClausePsPartBuilder is applicable for
- * a given WhereClauseExpression.
- *
- * @param whereClauseExpression the WhereClauseExpression in question.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return true if applicable, false otherwise.
- */
- public boolean isApplicable(
- WhereClauseExpression whereClauseExpression,
- Adapter adapter)
- {
- if (whereClauseExpression.getOperator().equals(SqlEnum.ISNULL)
- || whereClauseExpression.getOperator().equals(SqlEnum.ISNOTNULL))
- {
- return true;
- }
- Object rValue = whereClauseExpression.getRValue();
- if (rValue != null
- && (!(rValue instanceof ObjectKey)
- || ((ObjectKey) rValue).getValue() != null))
- {
- return false;
- }
- if (whereClauseExpression.getOperator().equals(SqlEnum.EQUAL)
- || whereClauseExpression.getOperator().equals(SqlEnum.NOT_EQUAL)
- || whereClauseExpression.getOperator().equals(
- SqlEnum.ALT_NOT_EQUAL))
- {
- return true;
- }
- return false;
- }
-}
+package org.apache.torque.sql.whereclausebuilder;
+
+/*
+ * 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 org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.PreparedStatementPart;
+import org.apache.torque.criteria.SqlEnum;
+import org.apache.torque.om.ObjectKey;
+import org.apache.torque.sql.WhereClauseExpression;
+
+/**
+ * Builds a PreparedStatementPart from a WhereClauseExpression which
+ * rhs is null and which has one of the comparison opertator =, <>, or !=,
+ * or which operator is SqlEnum.ISNULL or SqlEnum.ISNOTNULL
+
+ *
+ * @version $Id$
+ */
+public class NullValueBuilder extends AbstractWhereClausePsPartBuilder
+{
+ /**
+ * Builds a PreparedStatementPart from a WhereClauseExpression which
+ * rhs is null and which has one of the comparison opertator =, <>, or !=.
+ *
+ * @param whereClausePart the part of the where clause to build.
+ * Can be modified in this method.
+ * @param ignoreCase If true and columns represent Strings, the appropriate
+ * function defined for the database will be used to ignore
+ * differences in case.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return the rendered SQL for the WhereClauseExpression
+ */
+ public PreparedStatementPart buildPs(
+ WhereClauseExpression whereClausePart,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException
+ {
+ PreparedStatementPart result;
+ if (whereClausePart.getOperator().equals(SqlEnum.ISNULL)
+ || whereClausePart.getOperator().equals(SqlEnum.ISNOTNULL))
+ {
+ result = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(), ignoreCase, adapter);
+ result.getSql().append(whereClausePart.getOperator());
+ return result;
+ }
+
+ // now we know from isApplicable() that rValue is null or is
+ // an ObjectKey containing null
+ if (whereClausePart.getOperator().equals(SqlEnum.EQUAL))
+ {
+ result = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(), ignoreCase, adapter);
+ result.getSql().append(SqlEnum.ISNULL);
+ return result;
+ }
+ if (whereClausePart.getOperator().equals(SqlEnum.NOT_EQUAL)
+ || whereClausePart.getOperator().equals(
+ SqlEnum.ALT_NOT_EQUAL))
+ {
+ result = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(), ignoreCase, adapter);
+ result.getSql().append(SqlEnum.ISNOTNULL);
+ return result;
+ }
+ throw new IllegalStateException("unknown operator "
+ + whereClausePart.getOperator());
+ }
+
+ /**
+ * Returns whether this WhereClausePsPartBuilder is applicable for
+ * a given WhereClauseExpression.
+ *
+ * @param whereClauseExpression the WhereClauseExpression in question.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return true if applicable, false otherwise.
+ */
+ public boolean isApplicable(
+ WhereClauseExpression whereClauseExpression,
+ Adapter adapter)
+ {
+ if (whereClauseExpression.getOperator().equals(SqlEnum.ISNULL)
+ || whereClauseExpression.getOperator().equals(SqlEnum.ISNOTNULL))
+ {
+ return true;
+ }
+ Object rValue = whereClauseExpression.getRValue();
+ if (rValue != null
+ && (!(rValue instanceof ObjectKey)
+ || ((ObjectKey) rValue).getValue() != null))
+ {
+ return false;
+ }
+ if (whereClauseExpression.getOperator().equals(SqlEnum.EQUAL)
+ || whereClauseExpression.getOperator().equals(SqlEnum.NOT_EQUAL)
+ || whereClauseExpression.getOperator().equals(
+ SqlEnum.ALT_NOT_EQUAL))
+ {
+ return true;
+ }
+ return false;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/NullValueBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/StandardBuilder.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/StandardBuilder.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/StandardBuilder.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/StandardBuilder.java Wed Feb 20 21:06:35 2013
@@ -1,79 +1,79 @@
-package org.apache.torque.sql.whereclausebuilder;
-
-/*
- * 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 org.apache.torque.TorqueException;
-import org.apache.torque.adapter.Adapter;
-import org.apache.torque.criteria.PreparedStatementPart;
-import org.apache.torque.sql.WhereClauseExpression;
-
-/**
- * Builds a PreparedStatementPart from a WhereClauseExpression which
- * RHS and LHS is a simple value.
- *
- * @version $Id$
- */
-public class StandardBuilder extends AbstractWhereClausePsPartBuilder
-{
- /**
- * Builds a PreparedStatementPart from a WhereClauseExpression which
- * RHS and LHS is a simple value.
- *
- * @param whereClausePart the part of the where clause to build.
- * Can be modified in this method.
- * @param ignoreCase If true and columns represent Strings, the appropriate
- * function defined for the database will be used to ignore
- * differences in case.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return the rendered SQL for the WhereClauseExpression
- */
- public PreparedStatementPart buildPs(
- WhereClauseExpression whereClausePart,
- boolean ignoreCase,
- Adapter adapter)
- throws TorqueException
- {
- PreparedStatementPart result = getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getLValue(), ignoreCase, adapter);
- result.getSql().append(whereClausePart.getOperator());
- result.append(getObjectOrColumnPsPartBuilder().buildPs(
- whereClausePart.getRValue(), ignoreCase, adapter));
- return result;
- }
-
- /**
- * Returns whether this WhereClausePsPartBuilder is applicable for
- * a given WhereClauseExpression.
- *
- * @param whereClauseExpression the WhereClauseExpression in question.
- * @param adapter The adapter for the database for which the SQL
- * should be created, not null.
- *
- * @return true if applicable, false otherwise.
- */
- public boolean isApplicable(
- WhereClauseExpression whereClauseExpression,
- Adapter adapter)
- {
- return true;
- }
-}
+package org.apache.torque.sql.whereclausebuilder;
+
+/*
+ * 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 org.apache.torque.TorqueException;
+import org.apache.torque.adapter.Adapter;
+import org.apache.torque.criteria.PreparedStatementPart;
+import org.apache.torque.sql.WhereClauseExpression;
+
+/**
+ * Builds a PreparedStatementPart from a WhereClauseExpression which
+ * RHS and LHS is a simple value.
+ *
+ * @version $Id$
+ */
+public class StandardBuilder extends AbstractWhereClausePsPartBuilder
+{
+ /**
+ * Builds a PreparedStatementPart from a WhereClauseExpression which
+ * RHS and LHS is a simple value.
+ *
+ * @param whereClausePart the part of the where clause to build.
+ * Can be modified in this method.
+ * @param ignoreCase If true and columns represent Strings, the appropriate
+ * function defined for the database will be used to ignore
+ * differences in case.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return the rendered SQL for the WhereClauseExpression
+ */
+ public PreparedStatementPart buildPs(
+ WhereClauseExpression whereClausePart,
+ boolean ignoreCase,
+ Adapter adapter)
+ throws TorqueException
+ {
+ PreparedStatementPart result = getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getLValue(), ignoreCase, adapter);
+ result.getSql().append(whereClausePart.getOperator());
+ result.append(getObjectOrColumnPsPartBuilder().buildPs(
+ whereClausePart.getRValue(), ignoreCase, adapter));
+ return result;
+ }
+
+ /**
+ * Returns whether this WhereClausePsPartBuilder is applicable for
+ * a given WhereClauseExpression.
+ *
+ * @param whereClauseExpression the WhereClauseExpression in question.
+ * @param adapter The adapter for the database for which the SQL
+ * should be created, not null.
+ *
+ * @return true if applicable, false otherwise.
+ */
+ public boolean isApplicable(
+ WhereClauseExpression whereClauseExpression,
+ Adapter adapter)
+ {
+ return true;
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/whereclausebuilder/StandardBuilder.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