Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 79623 invoked from network); 22 Sep 2006 17:09:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Sep 2006 17:09:06 -0000 Received: (qmail 55354 invoked by uid 500); 22 Sep 2006 17:09:06 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 55289 invoked by uid 500); 22 Sep 2006 17:09:06 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 55270 invoked by uid 99); 22 Sep 2006 17:09:06 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Sep 2006 10:09:06 -0700 Authentication-Results: idunn.apache.osuosl.org smtp.mail=rhillegas@apache.org; spf=permerror X-ASF-Spam-Status: No, hits=-9.4 required=5.0 tests=ALL_TRUSTED,NO_REAL_NAME Received-SPF: error (idunn.apache.osuosl.org: domain apache.org from 140.211.166.113 cause and error) Received: from [140.211.166.113] ([140.211.166.113:54962] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id D1/D0-06791-8A814154 for ; Fri, 22 Sep 2006 10:08:58 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 875EA1A981D; Fri, 22 Sep 2006 10:08:46 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r449004 [2/2] - in /db/derby/code/branches/10.2: java/engine/org/apache/derby/iapi/services/io/ java/engine/org/apache/derby/iapi/sql/dictionary/ java/engine/org/apache/derby/iapi/sql/execute/ java/engine/org/apache/derby/iapi/types/ java/e... Date: Fri, 22 Sep 2006 17:08:44 -0000 To: derby-commits@db.apache.org From: rhillegas@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20060922170846.875EA1A981D@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original) +++ db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/SQLState.java Fri Sep 22 10:08:40 2006 @@ -127,6 +127,7 @@
  • 46000 for SQLJ errors (for now, leave this range empty)
  • 38000 SQL3 ranges
  • XD00x Dependency mgr
  • +
  • XMLxx Misc XML errors not covered by SQL standard
  • @@ -984,9 +985,7 @@ String LANG_INVALID_XML_QUERY_EXPRESSION = "42Z75"; String LANG_MULTIPLE_XML_CONTEXT_ITEMS = "42Z76"; String LANG_INVALID_CONTEXT_ITEM_TYPE = "42Z77"; - String LANG_MISSING_XML_CLASSES = "42Z78"; String LANG_XMLPARSE_UNKNOWN_PARAM_TYPE = "42Z79"; - String LANG_UNEXPECTED_XML_EXCEPTION = "42Z7Z"; String LANG_SERIALIZABLE = "42Z80.U"; String LANG_READ_COMMITTED = "42Z81.U"; @@ -1513,6 +1512,11 @@ String NET_READER_LENGTH_TOO_SMALL = "XN018.S"; String NET_XARETVAL_ERROR = "XN019.S"; + // XML - Derby-specific XML errors not covered by + // SQL standard. + String LANG_MISSING_XML_CLASSES = "XML00"; + String LANG_UNEXPECTED_XML_EXCEPTION = "XML01"; + // Used by server for scrollable updatable insensitive result sets // to transmit updated state to client. Internal, not seen by user. // Has no message in messages.properties as it is never printed. Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/xml_general.out URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/xml_general.out?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/xml_general.out (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/xml_general.out Fri Sep 22 10:08:40 2006 @@ -170,9 +170,9 @@ insert into t1 values (1, xmlparse(document '' strip whitespace)); ERROR 42Z74: XML feature not supported: 'STRIP WHITESPACE'. ij> insert into t1 values (1, xmlparse(document '')); -ERROR 42Z72: XML syntax error; missing keyword(s): 'PRESERVE WHITESPACE'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'PRESERVE WHITESPACE' at line 1, column 53. ij> insert into t1 values (1, xmlparse('' preserve whitespace)); -ERROR 42Z72: XML syntax error; missing keyword(s): 'DOCUMENT'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'DOCUMENT' at line 1, column 36. ij> insert into t1 values (1, xmlparse(content '' preserve whitespace)); ERROR 42Z74: XML feature not supported: 'CONTENT'. ij> select xmlparse(document xmlparse(document '' preserve whitespace) preserve whitespace) from t1; @@ -180,7 +180,7 @@ ij> select i from t1 where xmlparse(document '' preserve whitespace); ERROR 42X19: The WHERE or HAVING clause or CHECK CONSTRAINT definition is a 'XML' expression. It must be a BOOLEAN expression. ij> insert into t1 values (1, xmlparse(document '' preserve whitespace)); -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. +ERROR 2200M: Invalid XML DOCUMENT: XML document structures must start and end within the same entity. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> prepare ps1 as 'insert into t1(x) values XMLPARSE(document ? preserve whitespace)'; ij> -- These should work. insert into t1 values (5, xmlparse(document '' preserve whitespace)); @@ -253,9 +253,9 @@ 1 row inserted/updated/deleted ij> -- These should fail. select xmlserialize(x) from t1; -ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'AS' at line 1, column 22. ij> select xmlserialize(x as) from t1; -ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. +ERROR 42X01: Syntax error: Encountered "" at line 1, column 25. ij> select xmlserialize(x as int) from t1; ERROR 42Z73: Invalid target type for XMLSERIALIZE: 'INTEGER'. ij> select xmlserialize(x as varchar(20) for bit data) from t1; @@ -304,7 +304,7 @@ ij> -- These should succeed at the XMLEXISTS level, but fail with ----- parse/truncation errors. select xmlserialize(xmlparse(document vc preserve whitespace) as char(10)) from t4; -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. SQLSTATE: XJ001: Java exception: 'Content is not allowed in prolog.: xxxFILTERED-SAX-EXCEPTIONxxx'. +ERROR 2200M: Invalid XML DOCUMENT: Content is not allowed in prolog. SQLSTATE: XJ001: Java exception: 'Content is not allowed in prolog.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> select xmlserialize(x as char) from t1; ERROR 22001: A truncation error was encountered trying to shrink CHAR ' document was inserted as part of an UPDATE select xmlserialize(x as clob(10)) from t1; @@ -334,7 +334,7 @@ select xmlserialize(xmlparse(document '' preserve whitespace) as clob) from t2; 1 ----- -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. +ERROR 2200M: Invalid XML DOCUMENT: XML document structures must start and end within the same entity. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> select xmlserialize(xmlparse(document x preserve whitespace) as char(100)) from t1; ERROR 42X25: The 'XMLParse' function is not allowed on the 'XML' type. ij> -- These should succeed. @@ -649,7 +649,7 @@ xmlquery('data(//@*)' passing by ref x returning sequence empty on empty) as char(70)) from t1; -ERROR 10000: Encountered error while evaluating XML query expression for XMLQUERY operator; see next exception for details. SQLSTATE: XJ001: Java exception: 'Could not find function: data: javax.xml.transform.TransformerException'. +ERROR 10000: Encountered error while evaluating XML query expression for XMLQUERY operator: Could not find function: data SQLSTATE: XJ001: Java exception: 'Could not find function: data: javax.xml.transform.TransformerException'. ij> -- These should all succeed. Since it's Xalan that's actually doing ----- the query evaluation we don't need to test very many queries; we ----- just want to make sure we get the correct results when there is @@ -1199,6 +1199,66 @@ ----- 4.4 1 two le 3 trois +ij> -- DERBY-1718 +----- create trigger fails when SPS contains XML related op. +create table t9 (i int, x xml); +0 rows inserted/updated/deleted +ij> create table t10 (i int, x xml); +0 rows inserted/updated/deleted +ij> insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +1 row inserted/updated/deleted +ij> create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, xmlparse(document ' jane ' preserve whitespace)); +0 rows inserted/updated/deleted +ij> insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +1 row inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +----- +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +----- +1 | jane +ij> insert into t9 select * from t9; +2 rows inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +----- +1 | john +2 | ally +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +----- +1 | jane +1 | jane +ij> drop trigger tx; +0 rows inserted/updated/deleted +ij> delete from t9; +4 rows inserted/updated/deleted +ij> delete from t10; +2 rows inserted/updated/deleted +ij> insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +1 row inserted/updated/deleted +ij> create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, (select xmlquery('.' passing by ref x returning sequence empty on empty) from t9 where i = 1)); +0 rows inserted/updated/deleted +ij> insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +1 row inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +----- +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +----- +1 | john +ij> drop trigger tx; +0 rows inserted/updated/deleted ij> -- clean up. drop table t0; 0 rows inserted/updated/deleted @@ -1217,5 +1277,9 @@ ij> drop table t7; 0 rows inserted/updated/deleted ij> drop table t8; +0 rows inserted/updated/deleted +ij> drop table t9; +0 rows inserted/updated/deleted +ij> drop table t10; 0 rows inserted/updated/deleted ij> Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/xml_general.out URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/xml_general.out?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/xml_general.out (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/xml_general.out Fri Sep 22 10:08:40 2006 @@ -170,9 +170,9 @@ insert into t1 values (1, xmlparse(document '' strip whitespace)); ERROR 42Z74: XML feature not supported: 'STRIP WHITESPACE'. ij> insert into t1 values (1, xmlparse(document '')); -ERROR 42Z72: XML syntax error; missing keyword(s): 'PRESERVE WHITESPACE'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'PRESERVE WHITESPACE' at line 1, column 53. ij> insert into t1 values (1, xmlparse('' preserve whitespace)); -ERROR 42Z72: XML syntax error; missing keyword(s): 'DOCUMENT'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'DOCUMENT' at line 1, column 36. ij> insert into t1 values (1, xmlparse(content '' preserve whitespace)); ERROR 42Z74: XML feature not supported: 'CONTENT'. ij> select xmlparse(document xmlparse(document '' preserve whitespace) preserve whitespace) from t1; @@ -180,7 +180,7 @@ ij> select i from t1 where xmlparse(document '' preserve whitespace); ERROR 42X19: The WHERE or HAVING clause or CHECK CONSTRAINT definition is a 'XML' expression. It must be a BOOLEAN expression. ij> insert into t1 values (1, xmlparse(document '' preserve whitespace)); -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. +ERROR 2200M: Invalid XML DOCUMENT: XML document structures must start and end within the same entity. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> prepare ps1 as 'insert into t1(x) values XMLPARSE(document ? preserve whitespace)'; ERROR 42Z79: Unable to determine the parameter type for XMLPARSE; try using a CAST. ij> -- These should work. @@ -254,9 +254,9 @@ 1 row inserted/updated/deleted ij> -- These should fail. select xmlserialize(x) from t1; -ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'AS' at line 2, column 22. ij> select xmlserialize(x as) from t1; -ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. +ERROR 42X01: Syntax error: Encountered "" at line 1, column 25. ij> select xmlserialize(x as int) from t1; ERROR 42Z73: Invalid target type for XMLSERIALIZE: 'INTEGER'. ij> select xmlserialize(x as varchar(20) for bit data) from t1; @@ -305,7 +305,7 @@ ij> -- These should succeed at the XMLEXISTS level, but fail with ----- parse/truncation errors. select xmlserialize(xmlparse(document vc preserve whitespace) as char(10)) from t4; -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. SQLSTATE: XJ001: Java exception: 'Content is not allowed in prolog.: xxxFILTERED-SAX-EXCEPTIONxxx'. +ERROR 2200M: Invalid XML DOCUMENT: Content is not allowed in prolog. SQLSTATE: XJ001: Java exception: 'Content is not allowed in prolog.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> select xmlserialize(x as char) from t1; ERROR 22001: A truncation error was encountered trying to shrink CHAR ' document was inserted as part of an UPDATE select xmlserialize(x as clob(10)) from t1; @@ -335,7 +335,7 @@ select xmlserialize(xmlparse(document '' preserve whitespace) as clob) from t2; 1 ----- -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. +ERROR 2200M: Invalid XML DOCUMENT: XML document structures must start and end within the same entity. SQLSTATE: XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> select xmlserialize(xmlparse(document x preserve whitespace) as char(100)) from t1; ERROR 42X25: The 'XMLParse' function is not allowed on the 'XML' type. ij> -- These should succeed. @@ -650,7 +650,7 @@ xmlquery('data(//@*)' passing by ref x returning sequence empty on empty) as char(70)) from t1; -ERROR 10000: Encountered error while evaluating XML query expression for XMLQUERY operator; see next exception for details. SQLSTATE: XJ001: Java exception: 'Could not find function: data: javax.xml.transform.TransformerException'. +ERROR 10000: Encountered error while evaluating XML query expression for XMLQUERY operator: Could not find function: data SQLSTATE: XJ001: Java exception: 'Could not find function: data: javax.xml.transform.TransformerException'. ij> -- These should all succeed. Since it's Xalan that's actually doing ----- the query evaluation we don't need to test very many queries; we ----- just want to make sure we get the correct results when there is @@ -1200,6 +1200,66 @@ ----- 4.4 1 two le 3 trois +ij> -- DERBY-1718 +----- create trigger fails when SPS contains XML related op. +create table t9 (i int, x xml); +0 rows inserted/updated/deleted +ij> create table t10 (i int, x xml); +0 rows inserted/updated/deleted +ij> insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +1 row inserted/updated/deleted +ij> create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, xmlparse(document ' jane ' preserve whitespace)); +0 rows inserted/updated/deleted +ij> insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +1 row inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +----- +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +----- +1 | jane +ij> insert into t9 select * from t9; +2 rows inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +----- +1 | john +2 | ally +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +----- +1 | jane +1 | jane +ij> drop trigger tx; +0 rows inserted/updated/deleted +ij> delete from t9; +4 rows inserted/updated/deleted +ij> delete from t10; +2 rows inserted/updated/deleted +ij> insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +1 row inserted/updated/deleted +ij> create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, (select xmlquery('.' passing by ref x returning sequence empty on empty) from t9 where i = 1)); +0 rows inserted/updated/deleted +ij> insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +1 row inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +----- +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +----- +1 | john +ij> drop trigger tx; +0 rows inserted/updated/deleted ij> -- clean up. drop table t0; 0 rows inserted/updated/deleted @@ -1218,5 +1278,9 @@ ij> drop table t7; 0 rows inserted/updated/deleted ij> drop table t8; +0 rows inserted/updated/deleted +ij> drop table t9; +0 rows inserted/updated/deleted +ij> drop table t10; 0 rows inserted/updated/deleted ij> Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL.out Fri Sep 22 10:08:40 2006 @@ -40,19 +40,19 @@ ij(SATCONNECTION)> -- Revoke table permissions not granted already. This should raise warnings. revoke trigger on satheesh.tsat from foo; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from FOO. +WARNING 01006: Privilege not revoked from user FOO. ij(SATCONNECTION)> revoke references on satheesh.tsat from foo; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from FOO. +WARNING 01006: Privilege not revoked from user FOO. ij(SATCONNECTION)> -- This should raise warnings for bar revoke insert on satheesh.tsat from foo, bar; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from BAR. +WARNING 01006: Privilege not revoked from user BAR. ij(SATCONNECTION)> -- This should raise warnings for both foo and bar revoke insert on satheesh.tsat from foo, bar; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from FOO. -WARNING 01006: Privilege not revoked from BAR. +WARNING 01006: Privilege not revoked from user FOO. +WARNING 01006: Privilege not revoked from user BAR. ij(SATCONNECTION)> grant insert on satheesh.tsat to foo; 0 rows inserted/updated/deleted ij(SATCONNECTION)> -- Following revokes should revoke permissions @@ -87,7 +87,7 @@ ij(SATCONNECTION)> -- Revoke routine permission not granted already. This should raise a warning. revoke execute on function F_ABS(int) from bar RESTRICT; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from BAR. +WARNING 01006: Privilege not revoked from user BAR. ij(SATCONNECTION)> grant execute on function F_ABS to foo; 0 rows inserted/updated/deleted ij(SATCONNECTION)> grant execute on function F_ABS(int) to bar; @@ -412,10 +412,10 @@ 0 rows inserted/updated/deleted ij(SWIPERCONNECTION)> revoke select on swiperTab from satheesh; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from SATHEESH. +WARNING 01006: Privilege not revoked from user SATHEESH. ij(SWIPERCONNECTION)> revoke insert on swiperTab from satheesh; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from SATHEESH. +WARNING 01006: Privilege not revoked from user SATHEESH. ij(SWIPERCONNECTION)> set connection satConnection; ij(SATCONNECTION)> -- Should still work, as satheesh is DBA select * from swiper.swiperTab; @@ -435,7 +435,7 @@ 0 rows inserted/updated/deleted ij(SATCONNECTION)> revoke insert on swiper.swiperTab from satheesh; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from SATHEESH. +WARNING 01006: Privilege not revoked from user SATHEESH. ij(SATCONNECTION)> -- Test system routines. Some don't need explicit grant and others do -- allowing for only DBA use by default set connection satConnection; @@ -573,7 +573,7 @@ ij(MAMTA4)> set connection mamta1; ij(MAMTA1)> revoke all privileges on t11 from PUBLIC; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from PUBLIC. +WARNING 01006: Privilege not revoked from user PUBLIC. ij(MAMTA1)> select * from mamta1.t11; C111 ----------- @@ -630,7 +630,7 @@ 1 row selected ij(MAMTA1)> revoke select on t11 from mamta2, mamta3, mamta4; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from MAMTA4. +WARNING 01006: Privilege not revoked from user MAMTA4. ij(MAMTA1)> revoke update(c111, c112) on t11 from mamta2, mamta3, mamta4; 0 rows inserted/updated/deleted ij(MAMTA1)> drop table t11; @@ -984,7 +984,7 @@ ij(SATCONNECTION)> -- have the dba take away select privilege on mamta2.v21ViewTest from mamta3 revoke select on mamta2.v21ViewTest from mamta3; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from MAMTA3. +WARNING 01006: Privilege not revoked from user MAMTA3. ij(SATCONNECTION)> set connection mamta3; ij(MAMTA3)> -- select from mamta2.v21ViewTest will fail this time for mamta3 because dba took away the select privilege on mamta2.v21ViewTest select * from mamta2.v21ViewTest; @@ -1478,7 +1478,7 @@ ij(MAMTA1)> -- revoke privilege will succeed this time and will drop the dependent view on that privilege revoke select on t11ViewTest from mamta2; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from MAMTA2. +WARNING 01006: Privilege not revoked from user MAMTA2. ij(MAMTA1)> set connection mamta2; ij(MAMTA2)> -- view doesn't exist anymore select * from v21ViewTest; Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL2.out URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL2.out?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL2.out (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/grantRevokeDDL2.out Fri Sep 22 10:08:40 2006 @@ -314,7 +314,7 @@ ij(USER1)> -- revoking privilege that has not been granted, expect warning revoke select,insert,update,delete,trigger,references on t1 from user2; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from USER2. +WARNING 01006: Privilege not revoked from user USER2. ij(USER1)> -- syntax errors, expect errors grant select on t1 from user2; ERROR: Failed with SQLSTATE 42X01 @@ -487,10 +487,10 @@ ij(USER1)> -- expect warnings revoke update(c2) on t1 from user3; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from USER3. +WARNING 01006: Privilege not revoked from user USER3. ij(USER1)> revoke select(c2) on t1 from user3; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from USER3. +WARNING 01006: Privilege not revoked from user USER3. ij(USER1)> set connection user2; ij(USER2)> -- ok update user1.t1 set c2 = 'user2'; @@ -582,10 +582,10 @@ ij(USER1)> -- expect warning revoke select(c1) on t3 from user2; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from USER2. +WARNING 01006: Privilege not revoked from user USER2. ij(USER1)> revoke update(c2) on t3 from user2; 0 rows inserted/updated/deleted -WARNING 01006: Privilege not revoked from USER2. +WARNING 01006: Privilege not revoked from user USER2. ij(USER1)> set connection user2; ij(USER2)> select * from user1.t3; C1 |C2 |C3 Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/views.out URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/views.out?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/views.out (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/views.out Fri Sep 22 10:08:40 2006 @@ -340,4 +340,32 @@ 0 rows inserted/updated/deleted ij> -- reset autocommit autocommit on; +ij> -- DERBY-1304 +-- view not getting dropped +-- The second drop view statement fails before the patch +CREATE SCHEMA TEST_SCHEMA; +0 rows inserted/updated/deleted +ij> CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR); +0 rows inserted/updated/deleted +ij> CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1; +0 rows inserted/updated/deleted +ij> DROP VIEW TEST_SCHEMA.V1; +0 rows inserted/updated/deleted +ij> DROP TABLE TEST_SCHEMA.T1; +0 rows inserted/updated/deleted +ij> DROP SCHEMA TEST_SCHEMA RESTRICT; +0 rows inserted/updated/deleted +ij> -- reiterate +CREATE SCHEMA TEST_SCHEMA; +0 rows inserted/updated/deleted +ij> CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR); +0 rows inserted/updated/deleted +ij> CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1; +0 rows inserted/updated/deleted +ij> DROP VIEW TEST_SCHEMA.V1; +0 rows inserted/updated/deleted +ij> DROP TABLE TEST_SCHEMA.T1; +0 rows inserted/updated/deleted +ij> DROP SCHEMA TEST_SCHEMA RESTRICT; +0 rows inserted/updated/deleted ij> Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/xml_general.out URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/xml_general.out?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/xml_general.out (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/xml_general.out Fri Sep 22 10:08:40 2006 @@ -172,9 +172,9 @@ insert into t1 values (1, xmlparse(document '' strip whitespace)); ERROR 42Z74: XML feature not supported: 'STRIP WHITESPACE'. ij> insert into t1 values (1, xmlparse(document '')); -ERROR 42Z72: XML syntax error; missing keyword(s): 'PRESERVE WHITESPACE'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'PRESERVE WHITESPACE' at line 1, column 53. ij> insert into t1 values (1, xmlparse('' preserve whitespace)); -ERROR 42Z72: XML syntax error; missing keyword(s): 'DOCUMENT'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'DOCUMENT' at line 1, column 36. ij> insert into t1 values (1, xmlparse(content '' preserve whitespace)); ERROR 42Z74: XML feature not supported: 'CONTENT'. ij> select xmlparse(document xmlparse(document '' preserve whitespace) preserve whitespace) from t1; @@ -182,7 +182,7 @@ ij> select i from t1 where xmlparse(document '' preserve whitespace); ERROR 42X19: The WHERE or HAVING clause or CHECK CONSTRAINT definition is a 'XML' expression. It must be a BOOLEAN expression. ij> insert into t1 values (1, xmlparse(document '' preserve whitespace)); -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. +ERROR 2200M: Invalid XML DOCUMENT: XML document structures must start and end within the same entity. ERROR XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> prepare ps1 as 'insert into t1(x) values XMLPARSE(document ? preserve whitespace)'; ERROR 42Z79: Unable to determine the parameter type for XMLPARSE; try using a CAST. @@ -257,9 +257,9 @@ 1 row inserted/updated/deleted ij> -- These should fail. select xmlserialize(x) from t1; -ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. +ERROR 42Z72: Missing SQL/XML keyword(s) 'AS' at line 2, column 22. ij> select xmlserialize(x as) from t1; -ERROR 42Z72: XML syntax error; missing keyword(s): 'AS'. +ERROR 42X01: Syntax error: Encountered "" at line 1, column 25. ij> select xmlserialize(x as int) from t1; ERROR 42Z73: Invalid target type for XMLSERIALIZE: 'INTEGER'. ij> select xmlserialize(x as varchar(20) for bit data) from t1; @@ -311,7 +311,7 @@ 1 ---------- -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. +ERROR 2200M: Invalid XML DOCUMENT: Content is not allowed in prolog. ERROR XJ001: Java exception: 'Content is not allowed in prolog.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> select xmlserialize(x as char) from t1; 1 @@ -352,7 +352,7 @@ select xmlserialize(xmlparse(document '' preserve whitespace) as clob) from t2; 1 -------------------------------------------------------------------------------------------------------------------------------- -ERROR 2200M: Failed to parse XMLPARSE operand; see next exception for details. +ERROR 2200M: Invalid XML DOCUMENT: XML document structures must start and end within the same entity. ERROR XJ001: Java exception: 'XML document structures must start and end within the same entity.: xxxFILTERED-SAX-EXCEPTIONxxx'. ij> select xmlserialize(xmlparse(document x preserve whitespace) as char(100)) from t1; ERROR 42X25: The 'XMLParse' function is not allowed on the 'XML' type. @@ -668,7 +668,7 @@ xmlquery('data(//@*)' passing by ref x returning sequence empty on empty) as char(70)) from t1; -ERROR 10000: Encountered error while evaluating XML query expression for XMLQUERY operator; see next exception for details. +ERROR 10000: Encountered error while evaluating XML query expression for XMLQUERY operator: Could not find function: data ERROR XJ001: Java exception: 'Could not find function: data: javax.xml.transform.TransformerException'. ij> -- These should all succeed. Since it's Xalan that's actually doing -- the query evaluation we don't need to test very many queries; we @@ -1227,6 +1227,66 @@ -------------------------------------------------- 4.4 1 two le 3 trois +ij> -- DERBY-1718 +-- create trigger fails when SPS contains XML related op. +create table t9 (i int, x xml); +0 rows inserted/updated/deleted +ij> create table t10 (i int, x xml); +0 rows inserted/updated/deleted +ij> insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +1 row inserted/updated/deleted +ij> create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, xmlparse(document ' jane ' preserve whitespace)); +0 rows inserted/updated/deleted +ij> insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +1 row inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +-------------------------------- +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +-------------------------------- +1 | jane +ij> insert into t9 select * from t9; +2 rows inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +-------------------------------- +1 | john +2 | ally +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +-------------------------------- +1 | jane +1 | jane +ij> drop trigger tx; +0 rows inserted/updated/deleted +ij> delete from t9; +4 rows inserted/updated/deleted +ij> delete from t10; +2 rows inserted/updated/deleted +ij> insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +1 row inserted/updated/deleted +ij> create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, (select xmlquery('.' passing by ref x returning sequence empty on empty) from t9 where i = 1)); +0 rows inserted/updated/deleted +ij> insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +1 row inserted/updated/deleted +ij> select i, xmlserialize(x as varchar(20)) from t9; +I |2 +-------------------------------- +1 | john +2 | ally +ij> select i, xmlserialize(x as varchar(20)) from t10; +I |2 +-------------------------------- +1 | john +ij> drop trigger tx; +0 rows inserted/updated/deleted ij> -- clean up. drop table t0; 0 rows inserted/updated/deleted @@ -1245,5 +1305,9 @@ ij> drop table t7; 0 rows inserted/updated/deleted ij> drop table t8; +0 rows inserted/updated/deleted +ij> drop table t9; +0 rows inserted/updated/deleted +ij> drop table t10; 0 rows inserted/updated/deleted ij> Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TimeHandlingTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TimeHandlingTest.java?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TimeHandlingTest.java (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TimeHandlingTest.java Fri Sep 22 10:08:40 2006 @@ -20,6 +20,7 @@ */ package org.apache.derbyTesting.functionTests.tests.lang; +import java.io.UnsupportedEncodingException; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -29,6 +30,7 @@ import java.sql.Timestamp; import java.sql.Types; import java.util.Calendar; +import java.util.Random; import junit.framework.Test; import junit.framework.TestSuite; @@ -115,14 +117,118 @@ } /** - * Simple set up, just get a Calendar. + * Simple set up, just get a Calendar + * and ensure the table T_ALL is empty. + * @throws SQLException + * @throws UnsupportedEncodingException */ - protected void setUp() + protected void setUp() throws UnsupportedEncodingException, SQLException { cal = Calendar.getInstance(); + runSQLCommands("DELETE FROM TIME_ALL;"); } /** + * Test inserting and selecting of TIME values. + * A set of random TIME values are inserted along with an + * identifer that encodes the time value. The values are then + * fetched and compared to a value calculated from the identifier. + * The returned values are fetched using checkTimeValue thus inheriting + * all the checks within that method. + * @throws SQLException + * @throws UnsupportedEncodingException + */ + public void testInertTime() throws SQLException, UnsupportedEncodingException + { + getConnection().setAutoCommit(false); + // Insert a set of time values, + + + Random r = new Random(); + + // Insert 500 TIME values using a PreparedStatement, + // but randomly selecting the way the value is inserted + // between: + // java.sql.Time object + // String representation hh:mm:ss from Time.toString() + // String representation hh.mm.ss + + // prime number used to select the way the + // selected value is inserted. + final int itk = 71; + + PreparedStatement ps = prepareStatement( + "INSERT INTO TIME_ALL(ID, C_T) VALUES (?, ?)"); + + for (int i = 0; i < 500; i++) { + + // Just some big range from zero upwards + int id = r.nextInt(1000000); + ps.setInt(1, id); + + Time ct = getCodedTime(id); + + switch ((id % itk) % 3) + { + case 0: // Insert using Time object + ps.setTime(2, ct); + break; + case 1: // Insert using String provided by Time.toString() (hh:mm:ss) + ps.setString(2, ct.toString()); + break; + case 2: // Insert using String format (hh.mm.ss) + ps.setString(2, ct.toString().replace(':', '.')); + break; + default: + fail("not reached"); + + } + ps.executeUpdate(); + } + ps.close(); + commit(); + + Statement s = createStatement(); + + ResultSet rs = s.executeQuery("SELECT ID, C_T FROM TIME_ALL"); + int rowCount = 0; + while (rs.next()) + { + int id = rs.getInt(1); + Time t = checkTimeValue(rs, 2); + assertTimeEqual(getCodedTime(id), t); + rowCount++; + } + rs.close(); + s.close(); + commit(); + + assertEquals(rowCount, 500); + } + + /** + * Return a time simply encoded from an integer identifier + * and a set of fixed encoding keys, each a prime number. + * This allows a random value to be inserted into a table + * as a TIME and an INTEGER and thus checked for consistency + * on a SELECT. + * @param id + * @return + */ + private Time getCodedTime(int id) + { + final int hk = 17; + final int mk = 41; + final int sk = 67; + + int hour = (id % hk) % 24; + int min = (id % mk) % 60; + int sec = (id % sk) % 60; + + return getTime19700101(hour, min ,sec); + } + + /** * Tests for CURRENT TIME and CURRENT_TIME. * A set of tests that ensure the CURRENT TIME maintains * a single value for the life time of a statement and @@ -523,6 +629,7 @@ long now = System.currentTimeMillis(); Timestamp tsv = rs.getTimestamp(column); + long now2 = System.currentTimeMillis(); assertNotNull(tsv); assertFalse(rs.wasNull()); @@ -530,9 +637,13 @@ assertTimeEqual(tv, tsv); // DERBY-1811, DERBY-889 being fixed could add tests - // here to check the returned date portion is the current date - // using the value from 'now'. - + // Check the returned date portion is the current date + // using the value from 'now' and 'now2'. Double check + // just in case this test runs at midnight. + if (!(isDateEqual(now, tsv) || isDateEqual(now2, tsv))) + { + fail("TIME to java.sql.Timestamp does not contain current date " + tsv); + } String sv = rs.getString(column); assertNotNull(sv); @@ -687,7 +798,33 @@ } return tsv; - } + } + + /** + * Create a Time object that has its date components + * set to 1970/01/01 and its time to match the time + * represented by h, m and s. This matches Derby by + * setting the milli-second component to zero. + *
    + * Note that the Time(long) constructor for java.sql.Time + * does *not* set the date component to 1970/01/01. + * This is a requirement for JDBC java.sql.Time values though + */ + private Time getTime19700101(int hour, int min, int sec) + { + cal.clear(); + cal.set(1970, Calendar.JANUARY, 1); + cal.set(Calendar.MILLISECOND, 0); + + cal.set(Calendar.HOUR_OF_DAY, hour); + cal.set(Calendar.MINUTE, min); + cal.set(Calendar.SECOND, sec); + + Time to = new Time(cal.getTime().getTime()); + assertTime1970(to); + return to; + } + /** * Create a Time object that has its date components * set to 1970/01/01 and its time to match the time @@ -762,15 +899,15 @@ } /** - * Assert the time portion of a java.sql.Timestamp - * is equal to the value of a java.sql.Time. + * Assert the SQL time portion of two SQL JDBC type + * types are equal. * @param tv * @param tsv */ - private void assertTimeEqual(Time tv, Timestamp tsv) + private void assertTimeEqual(java.util.Date tv1, java.util.Date tv2) { cal.clear(); - cal.setTime(tv); + cal.setTime(tv1); int hour = cal.get(Calendar.HOUR_OF_DAY); int min = cal.get(Calendar.MINUTE); @@ -779,10 +916,31 @@ // Check the time portion is set to the same as tv cal.clear(); - cal.setTime(tsv); + cal.setTime(tv2); assertEquals(hour, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(min, cal.get(Calendar.MINUTE)); assertEquals(sec, cal.get(Calendar.SECOND)); assertEquals(ms, cal.get(Calendar.MILLISECOND)); + } + + /** + * Check if the date portion of a Timestamp value + * is equal to the date portion of a time value + * represented in milli-seconds since 1970. + */ + private boolean isDateEqual(long d, Timestamp tsv) + { + cal.clear(); + cal.setTime(new java.util.Date(d)); + int day = cal.get(Calendar.DAY_OF_MONTH); + int month = cal.get(Calendar.MONTH); + int year = cal.get(Calendar.YEAR); + + cal.clear(); + cal.setTime(tsv); + + return day == cal.get(Calendar.DAY_OF_MONTH) + && month == cal.get(Calendar.MONTH) + && year == cal.get(Calendar.YEAR); } } Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java Fri Sep 22 10:08:40 2006 @@ -80,7 +80,7 @@ Calendar cal = Calendar.getInstance(); // Make sure that we are not so close to midnight that TODAY might be yesterday before // we are finished using it. - while( cal.get( Calendar.HOUR) == 23 && cal.get( Calendar.MINUTE) == 58) + while( cal.get( Calendar.HOUR) == 23 && cal.get( Calendar.MINUTE) >= 58) { try { Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/views.sql Fri Sep 22 10:08:40 2006 @@ -163,3 +163,23 @@ -- reset autocommit autocommit on; + +-- DERBY-1304 +-- view not getting dropped +-- The second drop view statement fails before the patch +CREATE SCHEMA TEST_SCHEMA; +CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR); +CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1; + +DROP VIEW TEST_SCHEMA.V1; +DROP TABLE TEST_SCHEMA.T1; +DROP SCHEMA TEST_SCHEMA RESTRICT; + +-- reiterate +CREATE SCHEMA TEST_SCHEMA; +CREATE TABLE TEST_SCHEMA.T1 (TABLE_COLUMN LONG VARCHAR); +CREATE VIEW TEST_SCHEMA.V1 AS SELECT TABLE_COLUMN AS VIEW_COLUMN FROM TEST_SCHEMA.T1; + +DROP VIEW TEST_SCHEMA.V1; +DROP TABLE TEST_SCHEMA.T1; +DROP SCHEMA TEST_SCHEMA RESTRICT; Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/xml_general.sql URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/xml_general.sql?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/xml_general.sql (original) +++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/xml_general.sql Fri Sep 22 10:08:40 2006 @@ -697,6 +697,30 @@ from t1 where xmlexists('//@*' passing by ref x); +-- DERBY-1718 +-- create trigger fails when SPS contains XML related op. +create table t9 (i int, x xml); +create table t10 (i int, x xml); + +insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, xmlparse(document ' jane ' preserve whitespace)); +insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +select i, xmlserialize(x as varchar(20)) from t9; +select i, xmlserialize(x as varchar(20)) from t10; +insert into t9 select * from t9; +select i, xmlserialize(x as varchar(20)) from t9; +select i, xmlserialize(x as varchar(20)) from t10; +drop trigger tx; +delete from t9; +delete from t10; +insert into t9 values (1, xmlparse(document ' john ' preserve whitespace)); +create trigger tx after insert on t9 for each statement mode db2sql + insert into t10 values (1, (select xmlquery('.' passing by ref x returning sequence empty on empty) from t9 where i = 1)); +insert into t9 values (2, xmlparse(document ' ally ' preserve whitespace)); +select i, xmlserialize(x as varchar(20)) from t9; +select i, xmlserialize(x as varchar(20)) from t10; +drop trigger tx; -- clean up. drop table t0; drop table t1; @@ -707,3 +731,5 @@ drop table t6; drop table t7; drop table t8; +drop table t9; +drop table t10; \ No newline at end of file Modified: db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4 URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4 (original) +++ db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4 Fri Sep 22 10:08:40 2006 @@ -25,6 +25,9 @@ exit 1 fi +cygwin=false +darwin=false +mks=false case "`uname`" in CYGWIN*) cygwin=true ;; Darwin*) darwin=true ;; @@ -33,7 +36,7 @@ if [ -z "$JAVA_HOME" ]; then if [ -n "$darwin" ]; then JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home - fi else if [ -d /usr/j2se -a -x /usr/j2se/bin/javac ]; then + elif [ -d /usr/j2se -a -x /usr/j2se/bin/javac ]; then JAVA_HOME=/usr/j2se fi fi @@ -56,29 +59,47 @@ # Set up LOCALCLASSPATH, for cygwin or mks, use ; CPS=: -if [ -n "$cygwin" ]; then - CPS=';' -fi -if [ ! `expr index` = "index" ]; then # for MKS - if [ `expr index $SHELL sh.exe` -gt 0 ]; then +if [ \( "`expr $SHELL : '.*sh.exe$'`" -gt 0 \) -a \( "$cygwin" = "false" \) ]; then CPS=';' - fi + mks=true fi LOCALCLASSPATH="$DERBY_HOME/lib/derby.jar$CPS$DERBY_HOME/lib/derbyclient.jar" +# adjust paths for cygwin +DERBY_HOME_NML=$DERBY_HOME +if $cygwin; then + if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then + format=mixed + else + format=windows + fi + DERBY_HOME_NML=`cygpath --$format "$DERBY_HOME_NML"` + JAVA_HOME=`cygpath --$format "$JAVA_HOME"` + LOCALCLASSPATH=`cygpath --path --$format "$LOCALCLASSPATH"` + SRCDIR=`cygpath --path --$format "$SRCDIR"` + # now set CPS to ; for later use + CPS=';' +fi + # compile the client classes echo "Compiling the client classes for JDBC 4.0" for i in `cat client.list` do - FILE=`echo $i | tr '\\' '/' | sed 's/.$//g'` + FILE=`echo $i | tr '\\' '/'` + if [ ! \( "$cygwin" = "true" \) -o \( "$mks" = "true" \) ]; then + FILE=`echo $FILE | sed 's/.$//g'` + fi + if $mks; then + FILE=$i + fi CLASSES="$FILE $CLASSES" done cd $SRCDIR/java/client mkdir -p "$DERBY_HOME/jdbc4classes/client" -"$JAVA_HOME/bin/javac" -d "$DERBY_HOME/jdbc4classes/client" \ +"$JAVA_HOME/bin/javac" -d "$DERBY_HOME_NML/jdbc4classes/client" \ -cp "$LOCALCLASSPATH" \ - -sourcepath "$SRCDIR/java/client$CPS$SRCDIR/java/shared" \ + -sourcepath "$SRCDIR/java/client$CPS$SRCDIR/java/shared$CPS$SRCDIR/java/engine" \ $CLASSES if [ $? -gt 0 ]; then @@ -90,7 +111,7 @@ cd $THISDIR echo "Updating derbyclient.jar" -jar uf "$DERBY_HOME/lib/derbyclient.jar" -C "$DERBY_HOME/jdbc4classes/client" org +"$JAVA_HOME/bin/jar" uf "$DERBY_HOME_NML/lib/derbyclient.jar" -C "$DERBY_HOME_NML/jdbc4classes/client" org if [ $? -gt 0 ]; then echo "Error updating derbyclient.jar. It may no longer be usable." @@ -102,17 +123,32 @@ unset CLASSES for i in `cat engine.list` do - FILE=`echo $i | tr '\\' '/' | sed 's/.$//g'` + FILE=`echo $i | tr '\\' '/'` + if [ ! "$cygwin" = "true" ]; then + FILE=`echo $FILE | sed 's/.$//g'` + fi + if $mks; then + FILE=$i + fi CLASSES="$FILE $CLASSES" done cd "$SRCDIR/java/engine" mkdir -p "$DERBY_HOME/jdbc4classes/engine" -"$JAVA_HOME/bin/javac" -d "$DERBY_HOME/jdbc4classes/engine" \ +"$JAVA_HOME/bin/javac" -d "$DERBY_HOME_NML/jdbc4classes/engine" \ -cp "$LOCALCLASSPATH" \ -sourcepath "$SRCDIR/java/engine$CPS$SRCDIR/java/shared" \ $CLASSES +# patch up modules.properties do the driver will load +cd "$DERBY_HOME/jdbc4classes/engine" +"$JAVA_HOME/bin/jar" xf "$DERBY_HOME_NML/lib/derby.jar" org/apache/derby/modules.properties +if $cygwin; then + cat "$THISDIR/modules.patch" >> "$DERBY_HOME/jdbc4classes/engine/org/apache/derby/modules.properties" +elif [ ! "$cygwin" = "true" ]; then + cat "$THISDIR/modules.patch" | sed 's/.$//g' >> "$DERBY_HOME/jdbc4classes/engine/org/apache/derby/modules.properties" +fi + if [ $? -gt 0 ]; then echo "There was an error compiling the engine classes. Exiting." cd "$THISDIR" @@ -122,7 +158,7 @@ cd "$THISDIR" echo "Updating derby.jar" -jar uf "$DERBY_HOME/lib/derby.jar" -C "$DERBY_HOME/jdbc4classes/engine" org +"$JAVA_HOME/bin/jar" uf "$DERBY_HOME_NML/lib/derby.jar" -C "$DERBY_HOME_NML/jdbc4classes/engine" org if [ $? -gt 0 ]; then echo "Error updating derby.jar. It may no longer be usable." Modified: db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4.bat URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4.bat?view=diff&rev=449004&r1=449003&r2=449004 ============================================================================== --- db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4.bat (original) +++ db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4.bat Fri Sep 22 10:08:40 2006 @@ -1,3 +1,4 @@ +@echo off @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @REM distributed with this work for additional information @@ -31,6 +32,7 @@ :setLocalClasspath set LOCALCLASSPATH=%DERBY_HOME%\lib\derby.jar;%DERBY_HOME%\lib\derbyclient.jar +@rmdir /s /q %DERBY_HOME%\jdbc4classes :checkJava set _JAVACMD=%JAVACMD% @@ -46,25 +48,31 @@ if "%_JARCMD%" == "" set _JAVACMD=jar.exe :endcheck -echo "Building Derby client classes for JDBC 4.0" +echo Building Derby client classes for JDBC 4.0... mkdir %DERBY_HOME%\jdbc4classes\client cd %SRCDIR%\java\client FOR /F %%G in (%THISDIR%client.list) do %_JAVACMD% -d %DERBY_HOME%\jdbc4classes\client -classpath %LOCALCLASSPATH% -sourcepath "%CLIENTDIR%;%ENGINEDIR%;%SHAREDDIR%" %%G -echo "Updating %DERBY_HOME%\lib\derbyclient.jar" +echo Updating %DERBY_HOME%\lib\derbyclient.jar %_JARCMD% uf %DERBY_HOME%\lib\derbyclient.jar -C %DERBY_HOME%\jdbc4classes\client org -echo "Building Derby engine classes for JDBC 4.0" +echo Building Derby engine classes for JDBC 4.0 mkdir %DERBY_HOME%\jdbc4classes\engine +@rem stop the compiler from trying to recompile EmbedDatabaseMetaData +cd %DERBY_HOME%\jdbc4classes\engine +%_JARCMD% xf %DERBY_HOME%\lib\derby.jar org\apache\derby\impl\jdbc\EmbedDatabaseMetaData.class +%_JARCMD% xf %DERBY_HOME%\lib\derby.jar org\apache\derby\modules.properties cd %SRCDIR%\java\engine FOR /F %%G in (%THISDIR%engine.list) do %_JAVACMD% -d %DERBY_HOME%\jdbc4classes\engine -classpath %LOCALCLASSPATH% -sourcepath "%ENGINEDIR%;%SHAREDDIR%" %%G +copy /b %DERBY_HOME%\jdbc4classes\engine\org\apache\derby\modules.properties+%THISDIR%\modules.patch %DERBY_HOME%\jdbc4classes\engine\org\apache\derby\modules.properties +del /q %DERBY_HOME%\jdbc4classes\engine\org\apache\derby\impl\jdbc\EmbedDatabaseMetaData.class -echo "Updating %DERBY_HOME%\lib\derby.jar" +echo Updating %DERBY_HOME%\lib\derby.jar %_JARCMD% uf %DERBY_HOME%\lib\derby.jar -C %DERBY_HOME%\jdbc4classes\engine org cd %THISDIR% -echo "Cleaning up" -@erase /s /q %DERBY_HOME%/jdbc4classes -echo "Done." +echo Cleaning up +@rmdir /s /q %DERBY_HOME%\jdbc4classes +echo Done. :end