You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2011/08/23 21:24:31 UTC
svn commit: r1160861 - in /db/derby/code/branches/10.8/java:
engine/org/apache/derby/impl/sql/compile/ engine/org/apache/derby/vti/
testing/org/apache/derbyTesting/functionTests/tests/lang/
Author: rhillegas
Date: Tue Aug 23 19:24:31 2011
New Revision: 1160861
URL: http://svn.apache.org/viewvc?rev=1160861&view=rev
Log:
DERBY-5369: Port 1160858 from trunk to 10.8 branch.
Modified:
db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/RestrictedVTI.java
db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/Restriction.java
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java
Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java?rev=1160861&r1=1160860&r2=1160861&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java Tue Aug 23 19:24:31 2011
@@ -1471,8 +1471,8 @@ public class FromVTI extends FromTable i
case RelationalOperator.LESS_THAN_RELOP: return Restriction.ColumnQualifier.ORDER_OP_LESSTHAN;
case RelationalOperator.IS_NULL_RELOP: return Restriction.ColumnQualifier.ORDER_OP_ISNULL;
case RelationalOperator.IS_NOT_NULL_RELOP: return Restriction.ColumnQualifier.ORDER_OP_ISNOTNULL;
+ case RelationalOperator.NOT_EQUALS_RELOP: return Restriction.ColumnQualifier.ORDER_OP_NOT_EQUALS;
- case RelationalOperator.NOT_EQUALS_RELOP:
default:
if ( SanityManager.DEBUG )
{
Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/RestrictedVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/RestrictedVTI.java?rev=1160861&r1=1160860&r2=1160861&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/RestrictedVTI.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/RestrictedVTI.java Tue Aug 23 19:24:31 2011
@@ -41,7 +41,7 @@ import java.sql.SQLException;
* because they don't have to fetch all columns and rows. This can mean
* performance boosts for queries which only need a subset of the Table
* Function's columns and for queries which compare those columns to constant
- * expressions using the <, <=, =, >, and >= operators. This can also mean
+ * expressions using the <, <=, =, >, >=, and != operators. This can also mean
* performance boosts for LIKE and BETWEEN operations on Table Function
* columns. For more information, see the commentary on
* <a href="https://issues.apache.org/jira/browse/DERBY-4357">DERBY-4357</a>.
Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/Restriction.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/Restriction.java?rev=1160861&r1=1160860&r2=1160861&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/Restriction.java (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/vti/Restriction.java Tue Aug 23 19:24:31 2011
@@ -149,8 +149,11 @@ public abstract class Restriction implem
/** Ordering operation constant representing 'IS NOT NULL' **/
public static final int ORDER_OP_ISNOTNULL = 6;
+ /** Ordering operation constant representing '!=' **/
+ public static final int ORDER_OP_NOT_EQUALS = 7;
+
// Visible forms of the constants above
- private String[] OPERATOR_SYMBOLS = new String[] { "<", "=", "<=", ">", ">=", "IS NULL", "IS NOT NULL" };
+ private String[] OPERATOR_SYMBOLS = new String[] { "<", "=", "<=", ">", ">=", "IS NULL", "IS NOT NULL", "!=" };
////////////////////////////////////////////////////////////////////////////////////////
//
Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java?rev=1160861&r1=1160860&r2=1160861&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RestrictedVTITest.java Tue Aug 23 19:24:31 2011
@@ -957,9 +957,9 @@ public class RestrictedVTITest extends
/**
* Verify that Restriction.toSQL() returns usable SQL for all of the
- * comparable types.
+ * comparable types. See DERBY-5369 and DERBY-5370.
*/
- public void test_11_5370() throws Exception
+ public void test_11_5369_5370() throws Exception
{
Connection conn = getConnection();
@@ -975,21 +975,21 @@ public class RestrictedVTITest extends
vetDatatypeCount( conn, 22 );
// comparable types
- vet5370positive( conn, "BOOLEAN_COL", "false", "false" );
- vet5370positive( conn, "BIGINT_COL", "0", "0" );
- vet5370positive( conn, "CHAR_COL", "'0'", "0 " );
- vet5370positive( conn, "CHAR_FOR_BIT_DATA_COL", "X'de'", "de202020202020202020" );
- vet5370positive( conn, "DATE_COL", "DATE('1994-02-23')", "1994-02-23" );
- vet5370positive( conn, "DECIMAL_COL", "0.00", "0.00" );
- vet5370positive( conn, "REAL_COL", "0.0", "0.0" );
- vet5370positive( conn, "DOUBLE_COL", "0.0", "0.0" );
- vet5370positive( conn, "INT_COL", "0", "0" );
- vet5370positive( conn, "NUMERIC_COL", "0.00", "0.00" );
- vet5370positive( conn, "SMALLINT_COL", "0", "0" );
- vet5370positive( conn, "TIME_COL", "TIME('15:09:02')", "15:09:02" );
- vet5370positive( conn, "TIMESTAMP_COL", "TIMESTAMP('1962-09-23 03:23:34.234')", "1962-09-23 03:23:34.234" );
- vet5370positive( conn, "VARCHAR_COL", "'0'", "0" );
- vet5370positive( conn, "VARCHAR_FOR_BIT_DATA_COL", "X'de'", "de" );
+ vet5370positive( conn, "BOOLEAN_COL", "false", "false", "true" );
+ vet5370positive( conn, "BIGINT_COL", "0", "0", "1" );
+ vet5370positive( conn, "CHAR_COL", "'0'", "0 ", "1 " );
+ vet5370positive( conn, "CHAR_FOR_BIT_DATA_COL", "X'de'", "de202020202020202020", "dd202020202020202020" );
+ vet5370positive( conn, "DATE_COL", "DATE('1994-02-23')", "1994-02-23", "1994-02-24" );
+ vet5370positive( conn, "DECIMAL_COL", "0.00", "0.00", "1.00" );
+ vet5370positive( conn, "REAL_COL", "0.0", "0.0", "1.0" );
+ vet5370positive( conn, "DOUBLE_COL", "0.0", "0.0", "1.0" );
+ vet5370positive( conn, "INT_COL", "0", "0", "1" );
+ vet5370positive( conn, "NUMERIC_COL", "0.00", "0.00", "1.00" );
+ vet5370positive( conn, "SMALLINT_COL", "0", "0", "1" );
+ vet5370positive( conn, "TIME_COL", "TIME('15:09:02')", "15:09:02", "15:09:03" );
+ vet5370positive( conn, "TIMESTAMP_COL", "TIMESTAMP('1962-09-23 03:23:34.234')", "1962-09-23 03:23:34.234", "1963-09-23 03:23:34.234" );
+ vet5370positive( conn, "VARCHAR_COL", "'0'", "0", "1" );
+ vet5370positive( conn, "VARCHAR_FOR_BIT_DATA_COL", "X'de'", "de", "dd" );
//
// The following all fail. If these comparisons start working, then this
@@ -1006,7 +1006,8 @@ public class RestrictedVTITest extends
Connection conn,
String columnName,
String columnValue,
- String expectedValue
+ String expectedValue,
+ String negatedValue
)
throws Exception
{
@@ -1034,6 +1035,31 @@ public class RestrictedVTITest extends
},
false
);
+
+ assertResults
+ (
+ conn,
+ "select " + columnName + " from table( restricted5370( 'APP', 'T_5370' ) ) s\n" +
+ "where " + columnName + " != " + columnValue,
+ new String[][] { new String[] { negatedValue } },
+ false
+ );
+
+ assertResults
+ (
+ conn,
+ "values( lastQuery5370() )",
+ new String[][]
+ {
+ new String[]
+ {
+ "select " + doubleQuote( columnName ) + "\n" +
+ "from " + doubleQuote( "APP" ) + "." + doubleQuote( "T_5370" ) + "\n" +
+ "where " + doubleQuote( columnName ) + " != " + columnValue
+ }
+ },
+ false
+ );
}
private static String doubleQuote( String text ) { return '"' + text + '"'; }
private void vet5370negative