id
stringlengths 22
25
| commit_message
stringlengths 137
6.96k
| diffs
listlengths 0
63
|
|---|---|---|
derby-DERBY-4555-08cc0f89
|
DERBY-4555: Expand SYSCS_IMPORT_TABLE to accept CSV file with headers
DERBY-6893: Create new SYSCS_IMPORT_DATA_BULK procedure
This change was contributed by Danoja Dias (danojadias at gmail dot com)
This change modifies the method Import.importTable so that it has
a varargs interface, which makes it easier to call it in a variety
of ways from different system procedures.
Additionally, the change adds a new system procedure, named
SYSCS_UTIL.SYSCS_IMPORT_DATA_BULK, which is a variant of the
existing SYSCS_IMPORT_DATA system procedure, but has an additional
argument at the end that specifies the number of initial lines of
data in the input file to be skipped.
The anticipated use for this system procedure is to process input
data files which have been generated by a CSV-data-generating tool
which includes column header data at the start of the input file.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1751852 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/load/Import.java",
"hunks": [
{
"added": [
" boolean lobsInExtFile, short... extraArgs)"
],
"header": "@@ -182,7 +182,7 @@ public class Import extends ImportAbstract{",
"removed": [
" boolean lobsInExtFile)"
]
}
]
}
] |
derby-DERBY-4555-83668f1a
|
DERBY-4555: Expand SYSCS_IMPORT_TABLE to accept CSV file with header lines
DERBY-6894: Enhance COLUMNINDEXES parsing for SYSCS_IMPORT_DATA
This patch was contributed by Danoja Dias (danojadias at gmail dot com)
This patch is a follow-on to revision 1752990, and ensures that the
new readHeaders() logic correctly increments the ImportReadData's
lineNumber field as it's reading the column header lines, so that if
an error occurs while reading those header lines, a reasonable line
number is reported in the error message.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1753876 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4555-ea2e9393
|
DERBY-4555: Expand SYSCS_IMPORT_TABLE to accept CSV file with headers
DERBY-6892: Create new SYSCS_IMPORT_TABLE_BULK procedure
This change was contributed by Danoja Dias (danojadias at gmail dot com)
This change modifies the method Import.importTable so that it has
a varargs interface, which makes it easier to call it in a variety
of ways from different system procedures.
Additionally, the change adds a new system procedure, named
SYSCS_UTIL.SYSCS_IMPORT_TABLE_BULK, which is a variant of the
existing SYSCS_IMPORT_TABLE system procedure, but has an additional
argument at the end that specifies the number of initial lines of
data in the input file to be skipped.
The anticipated use for this system procedure is to process input
data files which have been generated by a CSV-data-generating tool
which includes column header data at the start of the input file.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1751159 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/load/Import.java",
"hunks": [
{
"added": [
" private static short skip; //The number of header lines to be skipped"
],
"header": "@@ -56,7 +56,7 @@ public class Import extends ImportAbstract{",
"removed": [
""
]
},
{
"added": [
"\t *",
"\t * The extraArgs parameter is variadic, and is used when this method is",
"\t * called from SYSCS_IMPORT_TABLE_BULK, in which case extraArgs[0]",
"\t * specifies the number of header lines to skip.",
"\t *"
],
"header": "@@ -103,6 +103,11 @@ public class Import extends ImportAbstract{",
"removed": []
},
{
"added": [
" short replace, boolean lobsInExtFile, short... extraArgs)"
],
"header": "@@ -121,7 +126,7 @@ public class Import extends ImportAbstract{",
"removed": [
" short replace, boolean lobsInExtFile)"
]
},
{
"added": [
" if(extraArgs.length>0)",
" skip=extraArgs[0];",
" else ",
" skip=0;",
""
],
"header": "@@ -137,7 +142,11 @@ public class Import extends ImportAbstract{",
"removed": [
"\t\t"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/ImportReadData.java",
"hunks": [
{
"added": [
" //The number of header lines to be skipped.",
" private short skipLines;"
],
"header": "@@ -36,7 +36,8 @@ import java.sql.SQLException;",
"removed": [
""
]
},
{
"added": [
" ImportReadData(String inputFileName, ControlInfo controlFileReader,short skipLines)",
" this.skipLines=skipLines;"
],
"header": "@@ -143,8 +144,9 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction<Ob",
"removed": [
" ImportReadData(String inputFileName, ControlInfo controlFileReader)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
" // add 10.13 specific system procedures",
" create_10_13_system_procedures( tc, newlyCreatedRoutines );"
],
"header": "@@ -11495,6 +11495,8 @@ public final class\tDataDictionaryImpl",
"removed": []
}
]
}
] |
derby-DERBY-4562-f6d5ae4d
|
DERBY-4562 Compilation of prepared statement results in Syntax Error
Patch derby-4562c. This fixes a problem with the parser logic to
determine if OFFSET is used as an identifer or is the start of an
offset clause. (Derby does not make OFFSET a reserved word for
compatibility reasons.)
The patch also adds new test cases.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@916075 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4563-32bd74ed
|
DERBY-4563: Avoid unnecessary use of getStream and getStreamWithDescriptor
Replaced use of StreamStorable.returnStream in the JDBC layer with
DataValueDescriptor.getStream.
Patch file: derby-4563-2a-replace_streamstorable_in_jdbclayer.diff
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@916640 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
" InputStream stream; // The stream we will return to the user",
" if (dvd.hasStream()) {",
" stream = new BinaryToRawStream(dvd.getStream(), dvd);",
" } else {",
" stream = new NewByteArrayInputStream(dvd.getBytes());",
" }"
],
"header": "@@ -1246,17 +1246,12 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\t\tStreamStorable ss = (StreamStorable) dvd;",
"",
"\t\t\tInputStream stream = ss.returnStream();",
"",
"\t\t\tif (stream == null)",
"\t\t\t{",
"\t\t\t\tstream = new NewByteArrayInputStream(dvd.getBytes());",
"\t\t\t} else",
"\t\t\t{",
"\t\t\t\tstream = new BinaryToRawStream(stream, dvd);",
"\t\t\t}"
]
}
]
}
] |
derby-DERBY-4563-541361f6
|
DERBY-4563: Avoid unnecessary use of getStream and getStreamWithDescriptor
Introduced the method DataValueDescriptor.hasStream() - use this method to check
if the data value is, or will be, represented by a stream.
Made DVD.getStream() and SDV.getStreamWithDescriptor() fail if hasStream returns
false (maybe this check can be removed, or made cheaper, in the near future?).
The reasoning behind the change is to make it easier to debug and investigate
issues concerned with incorrect stream state. If the stream is "leaked" from the
DVD, it is because it will be used to access the data. It will also be easier to
guarantee that the stream has a certain state, for instance that it is
positioned just before the first byte of user data when returned from the DVD.
It may be expensive to re-position the stream, which is why getStream() != null
isn't the best way to check if the value is a stream. The need to re-position is
again caused by missing (or non-exposed) functionality in the stream coming from
store.
In most cases the stream should only be obtained once from a given DVD, but
there are currently exceptions to the rule.
Patch file: derby-4563-1b-dvd_hasStream.diff
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@916261 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/SQLBinary.java",
"hunks": [
{
"added": [
" if (!hasStream()) {",
" throw StandardException.newException(",
" SQLState.LANG_STREAM_INVALID_ACCESS, getTypeName());",
" }"
],
"header": "@@ -211,6 +211,10 @@ abstract class SQLBinary",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLClob.java",
"hunks": [
{
"added": [
" throw StandardException.newException(",
" SQLState.LANG_STREAM_INVALID_ACCESS, getTypeName());"
],
"header": "@@ -350,7 +350,8 @@ public class SQLClob",
"removed": [
" return null;"
]
},
{
"added": [
" /**",
" * Tells if this CLOB value is, or will be, represented by a stream.",
" *",
" * @return {@code true} if the value is represented by a stream,",
" * {@code false} otherwise.",
" */",
" public boolean hasStream() {",
" return stream != null;",
" }",
""
],
"header": "@@ -421,6 +422,16 @@ public class SQLClob",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java",
"hunks": [
{
"added": [
" if (dvd.hasStream()) { // Cases b) and c)",
" streamPositionOffset = handleStreamValue(dvd.getStream(), con);",
" } else { // a) Blob already materialized in memory"
],
"header": "@@ -172,8 +172,9 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" InputStream dvdStream = dvd.getStream();",
" if (dvdStream == null) { // a) Blob already materialized in memory"
]
},
{
"added": [
" }",
" //add entry in connection so it can be cleared ",
" //when transaction is not valid",
" con.addLOBReference (this);",
" }",
"",
"",
" /**",
" * Constructs a Blob object on top of a stream.",
" *",
" * @param dvdStream the source stream",
" * @param con the connection owning the Blob",
" * @return The offset into the stream where the user data begins (used if",
" * resetting the stream).",
" * @throws StandardException if accessing the stream fails, or if writing",
" * data to temporary storage fails",
" */",
" private int handleStreamValue(InputStream dvdStream, EmbedConnection con)",
" throws StandardException {",
" int offset = 0;",
" // b) Resetable stream",
" // In this case the stream is coming from the Derby store.",
" if (dvdStream instanceof Resetable) {"
],
"header": "@@ -189,7 +190,29 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" } else if (dvdStream instanceof Resetable) { // b) Resetable stream"
]
},
{
"added": [
" offset = (int)myStream.getPosition();"
],
"header": "@@ -210,7 +233,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" streamPositionOffset = (int)myStream.getPosition();"
]
},
{
"added": [
" // c) Non-resetable stream",
" // This is most likely a stream coming in from the user, and we",
" // don't have any guarantees on how it behaves.",
" } else {"
],
"header": "@@ -225,7 +248,10 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" } else { // c) Non-resetable stream"
]
},
{
"added": [
" offset = Integer.MIN_VALUE;"
],
"header": "@@ -235,7 +261,7 @@ final class EmbedBlob extends ConnectionChild implements Blob, EngineLOB",
"removed": [
" streamPositionOffset = Integer.MIN_VALUE;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedClob.java",
"hunks": [
{
"added": [
" if (dvd.hasStream()) {",
" CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();"
],
"header": "@@ -111,21 +111,9 @@ final class EmbedClob extends ConnectionChild implements Clob, EngineLOB",
"removed": [
" CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();",
" if (csd == null) {",
" try {",
" clob = new TemporaryClob(dvd.getString(),",
" this);",
" }",
" catch (SQLException sqle) {",
" throw StandardException.newException (sqle.getSQLState(), sqle);",
" }",
" catch (IOException e) {",
" throw StandardException.newException (",
" SQLState.SET_STREAM_FAILURE, e);",
" }",
" } else {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
" java.io.Reader ret; // The reader we will return to the user",
" if (dvd.hasStream()) {",
" CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();",
" // See if we have to enforce a max field size.",
" if (lmfs > 0) {",
" csd = new CharacterStreamDescriptor.Builder().copyState(csd).",
" maxCharLength(lmfs).build();",
" }",
" ret = new UTF8Reader(csd, this, syncLock);",
" } else {",
" ret = new java.io.StringReader(val);",
""
],
"header": "@@ -1135,26 +1135,24 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
" CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();",
"",
" if (csd == null) {",
"",
"\t\t\t\tjava.io.Reader ret = new java.io.StringReader(val);",
"\t\t\t\tcurrentStream = ret;",
"\t\t\t\treturn ret;",
"\t\t\t}",
"",
" // See if we have to enforce a max field size.",
" if (lmfs > 0) {",
" csd = new CharacterStreamDescriptor.Builder().copyState(csd).",
" maxCharLength(lmfs).build();",
" java.io.Reader ret = new UTF8Reader(csd, this, syncLock);"
]
},
{
"added": [
"\t\t\t\tif (dvd.hasStream())"
],
"header": "@@ -3976,7 +3974,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\t\t\tif (dvd.getStream() != null)"
]
}
]
},
{
"file": "java/shared/org/apache/derby/shared/common/reference/SQLState.java",
"hunks": [
{
"added": [
" String LANG_STREAM_INVALID_ACCESS = \"42Z12.U\";"
],
"header": "@@ -1012,6 +1012,7 @@ public interface SQLState {",
"removed": []
}
]
}
] |
derby-DERBY-4564-2aa3e0b6
|
DERBY-4564 Replication tests do not pick up derby.tests.networkServerStartTimeout setting
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@916897 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4577-2f417333
|
DERBY-4577 An expanding update fails with an nospc.U error
Fixes problem on Overflow pages populated by long rows where the an expanding
update of the row would fail with a nospc.U error. The system always expects
updates to succeed. In the case of an expanding update that finds not enough
room there should always at least be enough room reserved/used in the row to
do an update that changes the row to just an overflow row pointer with no data,
moving the data to another page.
The problem was that on overflow pages not enough room was being reserved to
handle a worst case row with a overflow pointer. This fix reserves the worst
case space on overflow pages.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@959027 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java",
"hunks": [
{
"added": [
" * This is the length to reserve for either a column or row overflow"
],
"header": "@@ -289,7 +289,7 @@ public class StoredPage extends CachedPage",
"removed": [
" * This is the length to reserve for either an column or row overflow"
]
},
{
"added": [
" * reserve minimum space for recordPortionLength. Default is 1. To"
],
"header": "@@ -397,7 +397,7 @@ public class StoredPage extends CachedPage",
"removed": [
" * reserved minimum space for recordPortionLength. Default is 1. To"
]
},
{
"added": [
"\t\t\t\tSanityManager.THROWASSERT(",
" \"writePage detected problem in freespace and used space.\"",
" + \"slotsInUse = \" + slotsInUse"
],
"header": "@@ -969,7 +969,9 @@ public class StoredPage extends CachedPage",
"removed": [
"\t\t\t\tSanityManager.THROWASSERT(\"slotsInUse = \" + slotsInUse"
]
},
{
"added": [
"\t\tif ((spaceAvailable < minimumRecordSize) ||",
" (spaceAvailable < StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE))",
" {",
" }"
],
"header": "@@ -1296,8 +1298,11 @@ public class StoredPage extends CachedPage",
"removed": [
"\t\tif (spaceAvailable < minimumRecordSize)"
]
},
{
"added": [
" int total_space = getTotalSpace(slot);",
"",
"\t\t\t\t\tif ((!isOverflowPage() && ",
" (minimumRecordSize > total_space)) ||",
" (isOverflowPage() &&",
" (StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE >",
" total_space)))",
" // head rows including reserved space must be larger ",
" // than minimumRecordSize. ",
" //",
" // Overflow rows including reserved space must be ",
" // larger than MAX_OVERFLOW_ONLY_REC_SIZE.",
"",
" \"initSlotTable consistency check failed: \" +",
"\t\t\t\t\t\t\t\" totalSpace = \" + total_space +",
"\t\t\t\t\t\t\t\" recordPortionLength = \" + ",
" getRecordPortionLength(slot) + ",
" \" reservedCount = \" + getReservedCount(slot));"
],
"header": "@@ -2192,16 +2197,28 @@ public class StoredPage extends CachedPage",
"removed": [
"\t\t\t\t\tif (!isOverflowPage() && ",
" minimumRecordSize > getTotalSpace(slot))",
"\t\t\t\t\t\t\t\" totalSpace = \" + getTotalSpace(slot) + ",
"\t\t\t\t\t\t\t\"recordPortionLength = \" + ",
" getRecordPortionLength(slot) ",
"\t\t\t\t\t\t\t+ \" reservedCount = \" + getReservedCount(slot));"
]
},
{
"added": [
"\t\t\t\tif ((freeSpace < 0) || ",
" (firstFreeByte > getSlotOffset(slotsInUse - 1)) ||",
" getSlotOffset(slotsInUse - 1))) "
],
"header": "@@ -2237,9 +2254,10 @@ public class StoredPage extends CachedPage",
"removed": [
"\t\t\t\tif ((freeSpace < 0) || ",
" (getSlotOffset(slotsInUse - 1)))) "
]
},
{
"added": [],
"header": "@@ -3551,15 +3569,6 @@ public class StoredPage extends CachedPage",
"removed": [
"\t/**",
"\t\tLog a row into the StoreOuput stream.",
"",
"\t\t<P>",
"",
"\t\t@exception StandardException\tStandard Derby error policy",
"\t\t@exception IOException\t\t\tRESOLVE",
"",
"\t*/"
]
},
{
"added": [
" //",
"",
" if (SanityManager.DEBUG)",
" {",
" if (!forInsert)",
" {",
" // should not get into this path on an ",
" // update, only on an insert. Update should",
" // reserve space on page so you can always",
" // at least update the row with a single",
" // overflow pointer.",
" SanityManager.THROWASSERT(",
" \"no space to update a field on page. \" +",
" \"i = \" + i +",
" \"; startColumn = \" + startColumn + ",
" \"; lastColumnPositionAllowOverflow = \" +",
" lastColumnPositionAllowOverflow +",
" \"; spaceAvailable = \" + ",
" spaceAvailable +",
" \"; isOverflowPage() = \" + ",
" isOverflowPage() +",
" \"; OVERFLOW_POINTER_SIZE = \" + ",
" OVERFLOW_POINTER_SIZE +",
" \"\\npage = \\n\" + this);",
" }",
" }",
"",
" // DERBY-4577, on an update this bug may cause",
" // the following to be thrown on an update. Update",
" // code never expects this error to be thrown, and",
" // does not handle it. The fix to DERBY-4577 was",
" // to fix insert code to make sure enough space is",
" // always reserved on overflow pages such that ",
" // updates will never fail. But the fix does not",
" // affect existing problem overflow pages. If ",
" // this error is encountered in a table created ",
" // by software before the fix, run compress to ",
" // upgrade all data in table so that error will",
" // not be encountered in future.",
""
],
"header": "@@ -4103,6 +4112,46 @@ public class StoredPage extends CachedPage",
"removed": []
},
{
"added": [],
"header": "@@ -4200,7 +4249,6 @@ public class StoredPage extends CachedPage",
"removed": [
""
]
},
{
"added": [
"\t\tfreeSpace -= dataWritten;"
],
"header": "@@ -7157,7 +7205,7 @@ public class StoredPage extends CachedPage",
"removed": [
"\t\tfreeSpace -= dataWritten;"
]
},
{
"added": [
"\t\t\t\treservedSpace = minimumRecordSize - userData;",
"\t\t\t\tfreeSpace -= reservedSpace;",
" if (isOverflowPage())",
" {",
" // The total length of the row including the row header, field",
" // headers, user data, and unused reserve space must be at least",
" // as big as the worst case overflow row pointer. This is so that",
" // it always possible to do an expanding update on a row piece that",
" // in the worst case results in just using the existing space to",
" // put in an overflow pointer to another row segment on some other",
" // page.",
" int additional_space_needed = ",
" StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE - ",
" (dataWritten + reservedSpace);",
"",
" if (additional_space_needed > 0)",
" {",
" // need to reserve more space for the row to handle worst case",
" // update of the row to an overflow row piece.",
" freeSpace -= additional_space_needed;",
" firstFreeByte += additional_space_needed;",
" reservedSpace += additional_space_needed;",
" }",
" }",
"",
" if ((freeSpace < 0) || ",
" (firstFreeByte > getSlotOffset(slotsInUse - 1)) ||",
" ((firstFreeByte + freeSpace) != getSlotOffset(slotsInUse - 1)))",
" \" inconsistency in space management during insert: \" +",
" \" slot = \" + slot +",
" \" getSlotOffset(slot) = \" + getSlotOffset(slot) + ",
" \" dataWritten = \" + dataWritten +",
" \" freeSpace = \" + freeSpace + ",
" \" firstFreeByte = \" + firstFreeByte + ",
" \" page = \" + this);"
],
"header": "@@ -7167,28 +7215,52 @@ public class StoredPage extends CachedPage",
"removed": [
"\t\t\t\treservedSpace = minimumRecordSize - userData;",
"\t\t\t\tfreeSpace -= reservedSpace;",
" if ((firstFreeByte > getSlotOffset(slot)) ||",
" (freeSpace < 0))",
" \" firstFreeByte = \" + firstFreeByte + ",
" \" dataWritten = \" + dataWritten +",
" \" getSlotOffset(slot) = \" + getSlotOffset(slot) + ",
"\t\t\t\t\t\t\" slot = \" + slot +",
" \" firstFreeByte = \" + firstFreeByte + ",
" \" freeSpace = \" + freeSpace + ",
" \" page = \" + this);"
]
},
{
"added": [
" // move offset past record header to begin of first field.",
" offset += recordHeader.size();",
"\t\t\t\trawDataIn.setPosition(offset);"
],
"header": "@@ -8051,7 +8123,9 @@ public class StoredPage extends CachedPage",
"removed": [
"\t\t\t\trawDataIn.setPosition(offset + recordHeader.size());"
]
},
{
"added": [
"\t\t\t\t\t// In overflow page entire row needs to respect",
" // StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE."
],
"header": "@@ -8727,8 +8801,8 @@ slotScan:",
"removed": [
"\t\t\t\t\t// In overflow page, only need to respect",
"\t\t\t\t\t// RawStoreFactory.MINIMUM_RECORD_SIZE_DEFAULT"
]
},
{
"added": [
"",
" /**",
" * See if reserved space should be reclaimed for the input row.",
" * <p>",
" * See if the row on this page has reserved space that should be shrunk ",
" * once the update commits. Will only indicate space should be reclaimed",
" * if at least RawTransaction.MINIMUM_RECORD_SIZE_DEFAULT bytes can be",
" * reclaimed. ",
" * <p>",
" *",
" * @return true if space should be reclaimed from this row post commit.",
" **/",
"",
"\t\ttry ",
" {",
"\t\t\t// Only reclaim reserved space if it is \"reasonably\" sized, i.e., ",
" // we can reclaim at least MINIMUM_RECORD_SIZE_DEFAULT. Note",
" // any number could be used for \"reasonable\", not sure why",
" // MINIMUM_RECORD_SIZE_DEFAULT was chosen.",
"\t\t\tif (shrinkage > reclaimThreshold) ",
" {",
" // reserved space for row exceeds the threshold.",
"",
"\t\t\t\tif (isOverflowPage()) ",
" {",
" // For overflow pages the total row size, including ",
" // reserved space must be at least ",
" // StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE",
"",
" (StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE +",
" reclaimThreshold))",
" {",
" // row can reclaim at least the threshold space",
" }",
"\t\t\t\t} ",
" else ",
" {",
"\t\t\t\t\t// this is a head page. The total space of the row ",
" // including reserved space must total at least",
" // minimumRecordSize.",
"\t\t\t\t\tif (totalSpace > (minimumRecordSize + reclaimThreshold))",
" {",
" // row can reclaim at least the threshold space",
" }",
"\t\t} ",
" catch (IOException ioe) ",
" {"
],
"header": "@@ -8866,41 +8940,69 @@ slotScan:",
"removed": [
"\t\tSee if the row on this page has reserved space that can be shrunk once",
"\t\tthe update commits.",
"\t\ttry {",
"\t\t\t// Only reclaim reserved space if it is",
"\t\t\t// \"reasonably\" sized, i.e., we can reclaim at",
"\t\t\t// least MININUM_RECORD_SIZE_DEFAULT",
"\t\t\tif (shrinkage > reclaimThreshold) {",
"\t\t\t\tif (isOverflowPage()) {",
"\t\t\t\t\t\tRawStoreFactory.MINIMUM_RECORD_SIZE_DEFAULT+reclaimThreshold)",
"\t\t\t\t\t// Otherwise, I can at most reclaim less than",
"\t\t\t\t\t// MINIMUM_RECORD_SIZE_DEFAULT, forget about that.",
"\t\t\t\t} else {",
"\t\t\t\t\t// this is a head page",
"\t\t\t\t\tif (totalSpace > (minimumRecordSize +",
"\t\t\t\t\t\t\t\t\t RawStoreFactory.MINIMUM_RECORD_SIZE_DEFAULT)) ",
"",
"\t\t\t\t\t// Otherwise, I can at most reclaim less than",
"\t\t\t\t\t// MINIMUM_RECORD_SIZE_DEFAULT, forget about that.",
"\t\t} catch (IOException ioe) {"
]
},
{
"added": [
"\t\tif (!isOverflowPage()) ",
" {",
" // If this is a head row piece, first take care of the entire ",
" // overflow row chain. Don't need to worry about long column ",
" // because they are not in place updatable.",
"",
"\t\t\twhile (recordHeader.hasOverflow()) ",
" {",
" // loop calling compact on each piece of the overflow chain.",
"",
"\t\t\t\ttry ",
" {",
"\t\t\t\t\tint nextId = recordHeader.getOverflowId();",
"\t\t\t\t\tint nextSlot = ",
" getOverflowSlot(nextPageInRowChain, recordHeader);",
"\t\t\t\t} ",
" finally ",
" {"
],
"header": "@@ -8915,28 +9017,37 @@ slotScan:",
"removed": [
"\t\t// If this is a head row piece, first take care of the entire overflow",
"\t\t// row chain. Don't need to worry about long column because they are",
"\t\t// not in place updatable.",
"\t\tif (isOverflowPage() == false) {",
"\t\t\twhile (recordHeader.hasOverflow()) {",
"\t\t\t\ttry {",
"\t\t\t\t\tint nextId = recordHeader.getOverflowId();",
"\t\t\t\t\tint nextSlot = getOverflowSlot(nextPageInRowChain, recordHeader);",
"\t\t\t\t} finally {"
]
},
{
"added": [
"",
"",
"\t\t\tif (reserve > reclaimThreshold) ",
" {",
" // unused space exceeds the reclaim threshold.",
"",
"\t\t\t\tint recordLength = getRecordPortionLength(slot);",
" int totalSpace = recordLength + reserve;",
"",
"\t\t\t\tif (isOverflowPage()) ",
" {",
" // On an overflow page the total space of a record must",
" // be at least MAX_OVERFLOW_ONLY_REC_SIZE.",
"",
" if (totalSpace > ",
" (StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE +",
" reclaimThreshold))",
" {",
" // possible to reclaim more than threshold.",
"\t\t\t\t\t\tif (recordLength >= ",
" StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE)",
" {",
" }",
"\t\t\t\t\t\telse",
" {",
" // make sure record takes up max overflow rec size ",
" StoredRecordHeader.MAX_OVERFLOW_ONLY_REC_SIZE -",
" recordLength;",
" }",
"\t\t\t\t} ",
" else ",
" {",
"\t\t\t\t\t// this is a head page. The total space of the row ",
" // including reserved space must total at least",
" // minimumRecordSize.",
"",
"\t\t\t\t\tif (totalSpace > (minimumRecordSize + reclaimThreshold))",
" {",
"",
" {",
" }",
" {",
"\t\t\t\t\t\t\tcorrectReservedSpace = ",
" minimumRecordSize - recordLength;",
" }"
],
"header": "@@ -8946,33 +9057,64 @@ slotScan:",
"removed": [
"\t\t\tif (reserve > reclaimThreshold) {",
"\t\t\t\tint recordLength = getRecordPortionLength(slot);",
"\t\t\t\tif (isOverflowPage()) {",
"\t\t\t\t\tif ((reserve + recordLength) > ",
"\t\t\t\t\t\t(RawStoreFactory.MINIMUM_RECORD_SIZE_DEFAULT+reclaimThreshold))",
"\t\t\t\t\t{ ",
"\t\t\t\t\t\tif (recordLength >= RawStoreFactory.MINIMUM_RECORD_SIZE_DEFAULT)",
"\t\t\t\t\t\telse\t// make sure record takes up minimum_record_size ",
"\t\t\t\t\t\t\t\tRawStoreFactory.MINIMUM_RECORD_SIZE_DEFAULT - recordLength; ",
"\t\t\t\t} else {",
"\t\t\t\t\t// this is a head page",
"\t\t\t\t\tif ((reserve + recordLength) > ",
"\t\t\t\t\t\t(minimumRecordSize+reclaimThreshold)) {",
"\t\t\t\t\t\t\tcorrectReservedSpace = minimumRecordSize - recordLength;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/StoredRecordHeader.java",
"hunks": [
{
"added": [
" /**",
" * maximum length for row containing just an overflow pointer.",
" * <p>",
" * The maximum stored length of a row that just contains an overflow pointer",
" * is 17 bytes:",
" * stored sizeof(status byte) : 1 +",
" * stored sizeof(record id) : 4 +",
" * max stored size overflow page ptr: 8 +",
" * max stored size overflow record id: 4 ",
" **/",
" public static final int MAX_OVERFLOW_ONLY_REC_SIZE = ",
" 1 + // stored status byte",
" CompressedNumber.MAX_INT_STORED_SIZE + // max stored record id size",
" CompressedNumber.MAX_LONG_STORED_SIZE + // max stored overflow page ",
" CompressedNumber.MAX_INT_STORED_SIZE; // max stored overflow id",
""
],
"header": "@@ -85,6 +85,22 @@ public final class StoredRecordHeader",
"removed": []
}
]
}
] |
derby-DERBY-4582-204f3a0a
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)
Partial fix. This patch makes the server read time, date and timestamp
values from ResultSets and CallableStatements using the getter methods
that take a Calendar object. A GMT calendar is used, so that times
that are not possible to represent in the local time zone (like the
"lost hour" when switching to daylight saving time) are not silently
modified. The GMT calendar is also used when formatting the value
before it's sent to the client.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@937170 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [
" val = getObjectForWriteFdoca(rs, i, drdaType);",
" writeFdocaVal(i, val, drdaType,"
],
"header": "@@ -7111,7 +7111,8 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\t\twriteFdocaVal(i, rs.getObject(i),drdaType,"
]
},
{
"added": [
" val = getObjectForWriteFdoca(",
" (CallableStatement) stmt.ps, i, drdaType);"
],
"header": "@@ -7130,7 +7131,8 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\t\tval = ((CallableStatement) stmt.ps).getObject(i);"
]
},
{
"added": [
"",
" /**",
" * <p>",
" * Get a column value of the specified type from a {@code ResultSet}, in",
" * a form suitable for being writted by {@link #writeFdocaVal}. For most",
" * types, this means just calling {@code ResultSet.getObject(int)}.",
" * </p>",
" *",
" * <p>",
" * The only exception currently is the data types representing dates and",
" * times, as they need to be fetched using the same",
" * {@code java.util.Calendar} as {@link #writeFdocaVal} uses when writing",
" * them (DERBY-4582).",
" * </p>",
" *",
" * <p>",
" * <b>Note:</b> Changes made in this method should also be made in the",
" * corresponding method for {@code CallableStatement}:",
" * {@link #getObjectForWriteFdoca(java.sql.CallableStatement, int, int)}.",
" * </p>",
" *",
" * @param rs the result set to fetch the object from",
" * @param index the column index",
" * @param drdaType the DRDA type of the object to fetch",
" * @return an object with the value of the column",
" * @throws if a database error occurs while fetching the column value",
" * @see #getObjectForWriteFdoca(java.sql.CallableStatement, int, int)",
" */",
" private Object getObjectForWriteFdoca(ResultSet rs, int index, int drdaType)",
" throws SQLException {",
" // convert to corresponding nullable type to reduce number of cases",
" int ndrdaType = drdaType | 1;",
" switch (ndrdaType) {",
" case DRDAConstants.DRDA_TYPE_NDATE:",
" return rs.getDate(index, getGMTCalendar());",
" case DRDAConstants.DRDA_TYPE_NTIME:",
" return rs.getTime(index, getGMTCalendar());",
" case DRDAConstants.DRDA_TYPE_NTIMESTAMP:",
" return rs.getTimestamp(index, getGMTCalendar());",
" default:",
" return rs.getObject(index);",
" }",
" }",
"",
" /**",
" * <p>",
" * Get the value of an output parameter of the specified type from a",
" * {@code CallableStatement}, in a form suitable for being writted by",
" * {@link #writeFdocaVal}. For most types, this means just calling",
" * {@code CallableStatement.getObject(int)}.",
" * </p>",
" *",
" * <p>",
" * This method should behave like the corresponding method for",
" * {@code ResultSet}, and changes made to one of these methods, must be",
" * reflected in the other method. See",
" * {@link #getObjectForWriteFdoca(java.sql.ResultSet, int, int)}",
" * for details.",
" * </p>",
" *",
" * @param cs the callable statement to fetch the object from",
" * @param index the parameter index",
" * @param drdaType the DRDA type of the object to fetch",
" * @return an object with the value of the output parameter",
" * @throws if a database error occurs while fetching the parameter value",
" * @see #getObjectForWriteFdoca(java.sql.ResultSet, int, int)",
" */",
" private Object getObjectForWriteFdoca(CallableStatement cs,",
" int index, int drdaType)",
" throws SQLException {",
" // convert to corresponding nullable type to reduce number of cases",
" int ndrdaType = drdaType | 1;",
" switch (ndrdaType) {",
" case DRDAConstants.DRDA_TYPE_NDATE:",
" return cs.getDate(index, getGMTCalendar());",
" case DRDAConstants.DRDA_TYPE_NTIME:",
" return cs.getTime(index, getGMTCalendar());",
" case DRDAConstants.DRDA_TYPE_NTIMESTAMP:",
" return cs.getTimestamp(index, getGMTCalendar());",
" default:",
" return cs.getObject(index);",
" }",
" }",
""
],
"header": "@@ -7177,6 +7179,90 @@ class DRDAConnThread extends Thread {",
"removed": []
},
{
"added": [
"\t\t\t\t\twriter.writeString(formatDate((java.sql.Date) val));",
"\t\t\t\t\twriter.writeString(formatTime((Time) val));",
" writer.writeString(formatTimestamp((Timestamp) val));"
],
"header": "@@ -7766,26 +7852,13 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\twriter.writeString(((java.sql.Date) val).toString());",
"\t\t\t\t\twriter.writeString(((java.sql.Time) val).toString());",
"\t\t\t\t\t// we need to send it in a slightly different format, and pad it",
"\t\t\t\t\t// up to or truncate it to the correct number of characters",
" int timestampLength = appRequester.getTimestampLength();",
"\t\t\t\t\tString ts1 = ((java.sql.Timestamp) val).toString();",
"\t\t\t\t\tString ts2 = ts1.replace(' ','-').replace(':','.');",
"\t\t\t\t\tint tsLen = ts2.length();",
"\t\t\t\t\tif (tsLen < timestampLength)",
"\t\t\t\t\t{",
"\t\t\t\t\t\tfor (int i = 0; i < timestampLength-tsLen; i++)",
"\t\t\t\t\t\t\tts2 += \"0\";",
"\t\t\t\t\t}",
"\t\t\t\t\telse if (tsLen > timestampLength)",
"\t\t\t\t\t\tts2 = ts2.substring(0,timestampLength);",
"\t\t\t\t\twriter.writeString(ts2);"
]
},
{
"added": [
" /**",
" * Convert a {@code java.sql.Date} to a string with the format expected",
" * by the client.",
" *",
" * @param date the date to format",
" * @return a string on the format YYYY-MM-DD representing the date",
" * @see org.apache.derby.client.am.DateTime#dateBytesToDate",
" */",
" private String formatDate(java.sql.Date date) {",
" Calendar cal = getGMTCalendar();",
" cal.clear();",
" cal.setTime(date);",
"",
" char[] buf = \"YYYY-MM-DD\".toCharArray();",
" padInt(buf, 0, 4, cal.get(Calendar.YEAR));",
" padInt(buf, 5, 2, cal.get(Calendar.MONTH) + 1);",
" padInt(buf, 8, 2, cal.get(Calendar.DAY_OF_MONTH));",
"",
" return new String(buf);",
" }",
"",
" /**",
" * Convert a {@code java.sql.Time} to a string with the format expected",
" * by the client.",
" *",
" * @param time the time to format",
" * @return a string on the format HH:MM:SS representing the time",
" * @see org.apache.derby.client.am.DateTime#timeBytesToTime",
" */",
" private String formatTime(Time time) {",
" Calendar cal = getGMTCalendar();",
" cal.clear();",
" cal.setTime(time);",
"",
" char[] buf = \"HH:MM:SS\".toCharArray();",
" padInt(buf, 0, 2, cal.get(Calendar.HOUR_OF_DAY));",
" padInt(buf, 3, 2, cal.get(Calendar.MINUTE));",
" padInt(buf, 6, 2, cal.get(Calendar.SECOND));",
"",
" return new String(buf);",
" }",
"",
" /**",
" * Convert a {@code java.sql.Timestamp} to a string with the format",
" * expected by the client.",
" *",
" * @param ts the timestamp to format",
" * @return a string on the format YYYY-MM-DD-HH.MM.SS.ffffff[fff]",
" * @see org.apache.derby.client.am.DateTime#timestampBytesToTimestamp",
" */",
" private String formatTimestamp(Timestamp ts) {",
" Calendar cal = getGMTCalendar();",
" cal.clear();",
" cal.setTime(ts);",
"",
" char[] buf = new char[appRequester.getTimestampLength()];",
" padInt(buf, 0, 4, cal.get(Calendar.YEAR));",
" buf[4] = '-';",
" padInt(buf, 5, 2, cal.get(Calendar.MONTH) + 1);",
" buf[7] = '-';",
" padInt(buf, 8, 2, cal.get(Calendar.DAY_OF_MONTH));",
" buf[10] = '-';",
" padInt(buf, 11, 2, cal.get(Calendar.HOUR_OF_DAY));",
" buf[13] = '.';",
" padInt(buf, 14, 2, cal.get(Calendar.MINUTE));",
" buf[16] = '.';",
" padInt(buf, 17, 2, cal.get(Calendar.SECOND));",
" buf[19] = '.';",
"",
" int nanos = ts.getNanos();",
" if (appRequester.supportsTimestampNanoseconds()) {",
" padInt(buf, 20, 9, nanos);",
" } else {",
" padInt(buf, 20, 6, nanos / 1000);",
" }",
"",
" return new String(buf);",
" }",
"",
" /**",
" * Insert an integer into a char array and pad it with leading zeros if",
" * its string representation is shorter than {@code length} characters.",
" *",
" * @param buf the char array",
" * @param offset where in the array to start inserting the value",
" * @param length the desired length of the inserted string",
" * @param value the integer value to insert",
" */",
" private void padInt(char[] buf, int offset, int length, int value) {",
" final int radix = 10;",
" for (int i = offset + length - 1; i >= offset; i--) {",
" buf[i] = Character.forDigit(value % radix, radix);",
" value /= radix;",
" }",
" }",
""
],
"header": "@@ -7858,6 +7931,102 @@ class DRDAConnThread extends Thread {",
"removed": []
}
]
}
] |
derby-DERBY-4582-5e93fad1
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)
Fixed off-by-one error in the previous commit.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@938796 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4582-6f36c341
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)
Improved the regression test by adding a test case for updatable
result sets.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@933637 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4582-7d21df08
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)
Partial fix. This fix makes the server use a GMT calendar when it
reads a date, time or timestamp from the client. This way, the values
won't be changed if they refer to a point in time that does not exist
in the local time zone due to switch from/to daylight saving time (GMT
doesn't observe daylight saving time and therefore doesn't have these
holes in the range of valid values).
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@936218 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [
"import java.sql.Time;",
"import java.sql.Timestamp;",
"import java.util.Calendar;",
"import java.util.TimeZone;"
],
"header": "@@ -38,10 +38,14 @@ import java.sql.ResultSetMetaData;",
"removed": []
},
{
"added": [
" /** A cached {@code Calendar} instance using the GMT time zone. */",
" private Calendar gmtCalendar;",
"",
" /**",
" * Get a {@code Calendar} instance with time zone set to GMT. The instance",
" * is cached for reuse by this thread. This calendar can be used to",
" * consistently read and write date and time values using the same",
" * calendar. Since the local default calendar may not be able to represent",
" * all times (for instance because the time would fall into a non-existing",
" * hour of the day when switching to daylight saving time, see DERBY-4582),",
" * we use the GMT time zone which doesn't observe daylight saving time.",
" *",
" * @return a calendar in the GMT time zone",
" */",
" private Calendar getGMTCalendar() {",
" if (gmtCalendar == null) {",
" TimeZone gmt = TimeZone.getTimeZone(\"GMT\");",
" gmtCalendar = Calendar.getInstance(gmt);",
" }",
" return gmtCalendar;",
" }",
""
],
"header": "@@ -4527,6 +4531,28 @@ class DRDAConnThread extends Thread {",
"removed": []
},
{
"added": [
" Calendar cal = getGMTCalendar();",
" ps.setDate(i+1, parseDate(paramVal, cal), cal);"
],
"header": "@@ -4619,7 +4645,8 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\tps.setDate(i+1, java.sql.Date.valueOf(paramVal));"
]
},
{
"added": [
" Calendar cal = getGMTCalendar();",
" ps.setTime(i+1, parseTime(paramVal, cal), cal);"
],
"header": "@@ -4637,7 +4664,8 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\tps.setTime(i+1, java.sql.Time.valueOf(paramVal));"
]
},
{
"added": [
" Calendar cal = getGMTCalendar();",
" ps.setTimestamp(i+1, parseTimestamp(paramVal, cal), cal);",
"\t\t\t\t// thrown by parseTimestamp(...) for bad syntax..."
],
"header": "@@ -4654,18 +4682,10 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t\t\t\t\tString tsString = paramVal.substring(0,10) + \" \" +",
"\t\t\t\t\t\tparamVal.substring(11,19).replace('.', ':') +",
"\t\t\t\t\t\tparamVal.substring(19);",
"\t\t\t\t\tif (SanityManager.DEBUG)",
"\t\t\t\t\t\ttrace(\"tsString is: \"+tsString);",
"\t\t\t\t\tps.setTimestamp(i+1, java.sql.Timestamp.valueOf(tsString));",
"\t\t\t\t// thrown by Timestamp.valueOf(...) for bad syntax...",
"\t\t\t\t\tthrow new SQLException(SQLState.LANG_DATE_SYNTAX_EXCEPTION,",
"\t\t\t\t\t\tSQLState.LANG_DATE_SYNTAX_EXCEPTION.substring(0,5));",
"\t\t\t\t} catch (java.lang.StringIndexOutOfBoundsException e2) {",
"\t\t\t\t// can be thrown by substring(...) if syntax is invalid..."
]
},
{
"added": [
"",
" /**",
" * Parse a date string as it is received from the client.",
" *",
" * @param dateString the date string to parse",
" * @param cal the calendar in which the date is parsed",
" * @return a Date object representing the date in the specified calendar",
" * @see org.apache.derby.client.am.DateTime#dateToDateBytes",
" * @throws IllegalArgumentException if the date is not correctly formatted",
" */",
" private java.sql.Date parseDate(String dateString, Calendar cal) {",
" // Get each component out of YYYY-MM-DD",
" String[] components = dateString.split(\"-\");",
" if (components.length != 3) {",
" throw new IllegalArgumentException();",
" }",
"",
" cal.clear();",
"",
" // Set date components",
" cal.set(Calendar.YEAR, Integer.parseInt(components[0]));",
" cal.set(Calendar.MONTH, Integer.parseInt(components[1]) - 1);",
" cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(components[2]));",
"",
" // Normalize time components as specified by java.sql.Date",
" cal.set(Calendar.HOUR_OF_DAY, 0);",
" cal.set(Calendar.MINUTE, 0);",
" cal.set(Calendar.SECOND, 0);",
" cal.set(Calendar.MILLISECOND, 0);",
"",
" return new java.sql.Date(cal.getTimeInMillis());",
" }",
"",
" /**",
" * Parse a time string as it is received from the client.",
" *",
" * @param timeString the time string to parse",
" * @param cal the calendar in which the time is parsed",
" * @return a Date object representing the time in the specified calendar",
" * @see org.apache.derby.client.am.DateTime#timeToTimeBytes",
" * @throws IllegalArgumentException if the time is not correctly formatted",
" */",
" private Time parseTime(String timeString, Calendar cal) {",
" // Get each component out of HH:MM:SS",
" String[] components = timeString.split(\":\");",
" if (components.length != 3) {",
" throw new IllegalArgumentException();",
" }",
"",
" cal.clear();",
"",
" // Normalize date components as specified by java.sql.Time",
" cal.set(Calendar.YEAR, 1970);",
" cal.set(Calendar.MONTH, Calendar.JANUARY);",
" cal.set(Calendar.DAY_OF_MONTH, 1);",
"",
" // Set time components",
" cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(components[0]));",
" cal.set(Calendar.MINUTE, Integer.parseInt(components[1]));",
" cal.set(Calendar.SECOND, Integer.parseInt(components[2]));",
"",
" // No millisecond resolution for Time",
" cal.set(Calendar.MILLISECOND, 0);",
"",
" return new Time(cal.getTimeInMillis());",
" }",
"",
" /**",
" * Parse a timestamp string as it is received from the client.",
" *",
" * @param timeString the time string to parse",
" * @param cal the calendar in which the timestamp is parsed",
" * @return a Date object representing the timestamp in the specified",
" * calendar",
" * @see org.apache.derby.client.am.DateTime#timestampToTimestampBytes",
" * @throws IllegalArgumentException if the timestamp is not correctly",
" * formatted",
" */",
" private Timestamp parseTimestamp(String timeString, Calendar cal) {",
" // Get each component out of YYYY-MM-DD-HH.MM.SS.fffffffff",
" String[] components = timeString.split(\"[-.]\");",
" if (components.length != 7) {",
" throw new IllegalArgumentException();",
" }",
"",
" cal.clear();",
" cal.set(Calendar.YEAR, Integer.parseInt(components[0]));",
" cal.set(Calendar.MONTH, Integer.parseInt(components[1]) - 1);",
" cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(components[2]));",
" cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(components[3]));",
" cal.set(Calendar.MINUTE, Integer.parseInt(components[4]));",
" cal.set(Calendar.SECOND, Integer.parseInt(components[5]));",
"",
" int nanos = 0;",
"",
" final int radix = 10;",
" String nanoString = components[6];",
"",
" // Get up to nine digits from the nano second component",
" for (int i = 0; i < 9; i++) {",
" // Scale up the intermediate result",
" nanos *= radix;",
"",
" // Add the next digit, if there is one. Continue the loop even if",
" // there are no more digits, since we still need to scale up the",
" // intermediate result as if the fraction part were padded with",
" // zeros.",
" if (i < nanoString.length()) {",
" int digit = Character.digit(nanoString.charAt(i), radix);",
" if (digit == -1) {",
" // not a digit",
" throw new IllegalArgumentException();",
" }",
" nanos += digit;",
" }",
" }",
"",
" Timestamp ts = new Timestamp(cal.getTimeInMillis());",
" ts.setNanos(nanos);",
" return ts;",
" }"
],
"header": "@@ -4815,7 +4835,127 @@ class DRDAConnThread extends Thread {",
"removed": [
"\t"
]
}
]
}
] |
derby-DERBY-4582-7d521f50
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)
Last patch for this issue. Now the Calendar objects passed to the
getters in ResultSet and CallableStatement are passed further down to
where the parsing of the values from the server happens.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@938547 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/CallableStatement.java",
"hunks": [
{
"added": [
"import java.sql.Date;",
"import java.sql.Time;",
"import java.sql.Timestamp;",
"import java.util.Calendar;"
],
"header": "@@ -25,7 +25,11 @@ import org.apache.derby.client.ClientPooledConnection;",
"removed": []
},
{
"added": [
" public Date getDate(int parameterIndex, Calendar cal) throws SQLException {",
" agent_.logWriter_.traceEntry(",
" this, \"getDate\", parameterIndex, cal);",
"",
" if (cal == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
"",
" Date result = wasNullX() ?",
" null :",
" singletonRowData_.getDate(parameterIndex, cal);"
],
"header": "@@ -461,17 +465,26 @@ public class CallableStatement extends PreparedStatement",
"removed": [
" public java.sql.Date getDate(int parameterIndex) throws SQLException {",
" agent_.logWriter_.traceEntry(this, \"getDate\", parameterIndex);",
" java.sql.Date result = wasNullX() ? null : singletonRowData_.getDate(parameterIndex);"
]
},
{
"added": [
" public Date getDate(int parameterIndex) throws SQLException {",
" return getDate(parameterIndex, Calendar.getInstance());",
" public Time getTime(int parameterIndex, Calendar cal) throws SQLException {",
" agent_.logWriter_.traceEntry(",
" this, \"getTime\", parameterIndex, cal);",
"",
" if (cal == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
"",
" Time result = wasNullX() ?",
" null :",
" singletonRowData_.getTime(parameterIndex, cal);"
],
"header": "@@ -484,47 +497,30 @@ public class CallableStatement extends PreparedStatement",
"removed": [
" public java.sql.Date getDate(int parameterIndex, java.util.Calendar cal) throws SQLException {",
" synchronized (connection_) {",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceEntry(this, \"getDate\", parameterIndex, cal);",
" }",
" java.sql.Date result = getDate(parameterIndex);",
" if (cal == null) {",
" throw new SqlException(agent_.logWriter_, ",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL)).getSQLException();",
" }",
" if (result != null) {",
" java.util.Calendar targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());",
" targetCalendar.clear();",
" targetCalendar.setTime(result);",
" java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();",
" defaultCalendar.clear();",
"",
" defaultCalendar.setTime(result);",
" long timeZoneOffset =",
" targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +",
" targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);",
" result.setTime(result.getTime() - timeZoneOffset);",
" }",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceExit(this, \"getDate\", result);",
" }",
" return result;",
" }",
" public java.sql.Time getTime(int parameterIndex) throws SQLException {",
" agent_.logWriter_.traceEntry(this, \"getTime\", parameterIndex);",
" java.sql.Time result = wasNullX() ? null : singletonRowData_.getTime(parameterIndex);"
]
},
{
"added": [
" public Time getTime(int parameterIndex) throws SQLException {",
" return getTime(parameterIndex, Calendar.getInstance());",
" public Timestamp getTimestamp(int parameterIndex, Calendar cal)",
" throws SQLException {",
" agent_.logWriter_.traceEntry(",
" this, \"getTimestamp\", parameterIndex, cal);",
"",
" if (cal == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
"",
" Timestamp result = wasNullX() ?",
" null :",
" singletonRowData_.getTimestamp(parameterIndex, cal);"
],
"header": "@@ -537,46 +533,31 @@ public class CallableStatement extends PreparedStatement",
"removed": [
" public java.sql.Time getTime(int parameterIndex, java.util.Calendar cal) throws SQLException {",
" synchronized (connection_) {",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceEntry(this, \"getTime\", parameterIndex, cal);",
" }",
" java.sql.Time result = getTime(parameterIndex);",
" if (cal == null) {",
" throw new SqlException(agent_.logWriter_, ",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL)).getSQLException();",
" }",
" if (result != null) {",
" java.util.Calendar targetCalendar = java.util.Calendar.getInstance(cal.getTimeZone());",
" targetCalendar.clear();",
" targetCalendar.setTime(result);",
" java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();",
" defaultCalendar.clear();",
" defaultCalendar.setTime(result);",
" long timeZoneOffset =",
" targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +",
" targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);",
" result.setTime(result.getTime() - timeZoneOffset);",
" }",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceExit(this, \"getTime\", result);",
" }",
" return result;",
" }",
" public java.sql.Timestamp getTimestamp(int parameterIndex) throws SQLException {",
" agent_.logWriter_.traceEntry(this, \"getTimestamp\", parameterIndex);",
" java.sql.Timestamp result = wasNullX() ? null : singletonRowData_.getTimestamp(parameterIndex);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/CrossConverters.java",
"hunks": [
{
"added": [
"import java.sql.Date;",
"import java.sql.Time;",
"import java.sql.Timestamp;",
"import java.util.Calendar;"
],
"header": "@@ -21,6 +21,10 @@",
"removed": []
},
{
"added": [
" return date_valueOf(source, null);",
" return time_valueOf(source, null);",
" return timestamp_valueOf(source, null);"
],
"header": "@@ -558,13 +562,13 @@ final class CrossConverters {",
"removed": [
" return date_valueOf(source);",
" return time_valueOf(source);",
" return timestamp_valueOf(source);"
]
},
{
"added": [
" final Date getDateFromString(String source, Calendar cal)",
" throws SqlException {",
" return date_valueOf(source, cal);"
],
"header": "@@ -1221,9 +1225,10 @@ final class CrossConverters {",
"removed": [
" final java.sql.Date getDateFromString(String source) throws SqlException {",
" return date_valueOf(source);"
]
},
{
"added": [
" final Time getTimeFromString(String source, Calendar cal)",
" throws SqlException {",
" return time_valueOf(source, cal);"
],
"header": "@@ -1240,9 +1245,10 @@ final class CrossConverters {",
"removed": [
" final java.sql.Time getTimeFromString(String source) throws SqlException {",
" return time_valueOf(source);"
]
},
{
"added": [
" final Timestamp getTimestampFromString(String source, Calendar cal)",
" throws SqlException {",
" return timestamp_valueOf(source, cal);"
],
"header": "@@ -1255,9 +1261,10 @@ final class CrossConverters {",
"removed": [
" final java.sql.Timestamp getTimestampFromString(String source) throws SqlException {",
" return timestamp_valueOf(source);"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/Cursor.java",
"hunks": [
{
"added": [
"import java.sql.Date;",
"import java.sql.Time;",
"import java.util.Calendar;"
],
"header": "@@ -28,6 +28,9 @@ import java.io.BufferedReader;",
"removed": []
},
{
"added": [
" private final Date getDATE(int column, Calendar cal) throws SqlException {",
" cal,"
],
"header": "@@ -509,11 +512,11 @@ public abstract class Cursor {",
"removed": [
" private final java.sql.Date getDATE(int column) throws SqlException {",
" getRecyclableCalendar(), "
]
},
{
"added": [
" private final Time getTIME(int column, Calendar cal) throws SqlException {",
" cal,"
],
"header": "@@ -525,11 +528,11 @@ public abstract class Cursor {",
"removed": [
" private final java.sql.Time getTIME(int column) throws SqlException {",
" getRecyclableCalendar(),"
]
},
{
"added": [
" private final java.sql.Timestamp getTIMESTAMP(int column, Calendar cal)",
" throws SqlException {",
" cal,"
],
"header": "@@ -539,13 +542,14 @@ public abstract class Cursor {",
"removed": [
" private final java.sql.Timestamp getTIMESTAMP(int column) throws SqlException {",
" getRecyclableCalendar(), "
]
},
{
"added": [
" private final java.sql.Timestamp getTimestampFromDATE(",
" int column, Calendar cal) throws SqlException {",
" cal,"
],
"header": "@@ -556,11 +560,12 @@ public abstract class Cursor {",
"removed": [
" private final java.sql.Timestamp getTimestampFromDATE(int column) throws SqlException {",
" getRecyclableCalendar(), "
]
},
{
"added": [
" private final java.sql.Timestamp getTimestampFromTIME(",
" int column, Calendar cal) throws SqlException {",
" cal,"
],
"header": "@@ -570,11 +575,12 @@ public abstract class Cursor {",
"removed": [
" private final java.sql.Timestamp getTimestampFromTIME(int column) throws SqlException {",
" getRecyclableCalendar(),"
]
},
{
"added": [
" private final java.sql.Date getDateFromTIMESTAMP(int column, Calendar cal)",
" throws SqlException {",
" cal,"
],
"header": "@@ -584,11 +590,12 @@ public abstract class Cursor {",
"removed": [
" private final java.sql.Date getDateFromTIMESTAMP(int column) throws SqlException {",
" getRecyclableCalendar(),"
]
},
{
"added": [
" private final java.sql.Time getTimeFromTIMESTAMP(int column, Calendar cal)",
" throws SqlException {",
" cal,"
],
"header": "@@ -598,11 +605,12 @@ public abstract class Cursor {",
"removed": [
" private final java.sql.Time getTimeFromTIMESTAMP(int column) throws SqlException {",
" getRecyclableCalendar(),"
]
},
{
"added": [
" return getDATE(column, getRecyclableCalendar()).toString();",
" return getTIME(column, getRecyclableCalendar()).toString();",
" return getTIMESTAMP(column, getRecyclableCalendar()).toString();"
],
"header": "@@ -612,17 +620,17 @@ public abstract class Cursor {",
"removed": [
" return getDATE(column).toString();",
" return getTIME(column).toString();",
" return getTIMESTAMP(column).toString();"
]
},
{
"added": [
" final java.sql.Date getDate(int column, Calendar cal) throws SqlException {",
" return getDATE(column, cal);",
" return getDateFromTIMESTAMP(column, cal);",
" return agent_.crossConverters_.",
" getDateFromString(getCHAR(column), cal);",
" return agent_.crossConverters_.",
" getDateFromString(getVARCHAR(column), cal);",
" final java.sql.Time getTime(int column, Calendar cal) throws SqlException {",
" return getTIME(column, cal);",
" return getTimeFromTIMESTAMP(column, cal);",
" return agent_.crossConverters_.",
" getTimeFromString(getCHAR(column), cal);",
" return agent_.crossConverters_.",
" getTimeFromString(getVARCHAR(column), cal);",
" final java.sql.Timestamp getTimestamp(int column, Calendar cal)",
" throws SqlException {",
" return getTIMESTAMP(column, cal);",
" return getTimestampFromDATE(column, cal);",
" return getTimestampFromTIME(column, cal);",
" return agent_.crossConverters_.",
" getTimestampFromString(getCHAR(column), cal);",
" return agent_.crossConverters_.",
" getTimestampFromString(getVARCHAR(column), cal);"
],
"header": "@@ -967,53 +975,60 @@ public abstract class Cursor {",
"removed": [
" final java.sql.Date getDate(int column) throws SqlException {",
" return getDATE(column);",
" return getDateFromTIMESTAMP(column);",
" return agent_.crossConverters_.getDateFromString(getCHAR(column));",
" return agent_.crossConverters_.getDateFromString(getVARCHAR(column));",
" final java.sql.Time getTime(int column) throws SqlException {",
" return getTIME(column);",
" return getTimeFromTIMESTAMP(column);",
" return agent_.crossConverters_.getTimeFromString(getCHAR(column));",
" return agent_.crossConverters_.getTimeFromString(getVARCHAR(column));",
" final java.sql.Timestamp getTimestamp(int column) throws SqlException {",
" return getTIMESTAMP(column);",
" return getTimestampFromDATE(column);",
" return getTimestampFromTIME(column);",
" return agent_.crossConverters_.getTimestampFromString(getCHAR(column));",
" return agent_.crossConverters_.getTimestampFromString(getVARCHAR(column));"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/ResultSet.java",
"hunks": [
{
"added": [
"import java.sql.Date;",
"import java.sql.Time;",
"import java.sql.Timestamp;",
"import java.util.Calendar;"
],
"header": "@@ -24,8 +24,12 @@ package org.apache.derby.client.am;",
"removed": []
},
{
"added": [
" public java.sql.Date getDate(int column, Calendar cal) throws SQLException {"
],
"header": "@@ -861,7 +865,7 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
" public java.sql.Date getDate(int column) throws SQLException {"
]
},
{
"added": [
"",
" if (cal == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
"",
" // updateDate() doesn't take a calendar, so the retrieved",
" // value will be in the default calendar. Convert it to",
" // the requested calendar before returning it.",
" result = convertFromDefaultCalendar(result, cal);",
" result = isNull(column) ? null : cursor_.getDate(column, cal);"
],
"header": "@@ -870,11 +874,21 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
" result = isNull(column) ? null : cursor_.getDate(column);"
]
},
{
"added": [
" public java.sql.Date getDate(int column) throws SQLException {",
" return getDate(column, Calendar.getInstance());",
" public java.sql.Time getTime(int column, Calendar cal) throws SQLException {",
" agent_.logWriter_.traceEntry(this, \"getTime\", column, cal);",
"",
" if (cal == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
"",
" // updateTime() doesn't take a calendar, so the retrieved",
" // value will be in the default calendar. Convert it to",
" // the requested calendar before returning it.",
" result = convertFromDefaultCalendar(result, cal);",
" result = isNull(column) ? null : cursor_.getTime(column, cal);"
],
"header": "@@ -889,57 +903,35 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
" public java.sql.Date getDate(int column, java.util.Calendar calendar) throws SQLException {",
" try",
" {",
" closeCloseFilterInputStream();",
"",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceEntry(this, \"getDate\", column, calendar);",
" }",
" java.sql.Date date = getDate(column);",
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_, ",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
" if (date != null) {",
" java.util.Calendar targetCalendar = java.util.Calendar.getInstance(calendar.getTimeZone());",
" targetCalendar.clear();",
" targetCalendar.setTime(date);",
" java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();",
" defaultCalendar.clear();",
" defaultCalendar.setTime(date);",
" long timeZoneOffset =",
" targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +",
" targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);",
" date.setTime(date.getTime() - timeZoneOffset);",
" }",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceExit(this, \"getDate\", date);",
" }",
" return date;",
" }",
" catch ( SqlException se )",
" {",
" throw se.getSQLException();",
" } ",
" public java.sql.Time getTime(int column) throws SQLException {",
" agent_.logWriter_.traceEntry(this, \"getTime\", column);",
" result = isNull(column) ? null : cursor_.getTime(column);"
]
},
{
"added": [
" public java.sql.Time getTime(int column) throws SQLException {",
" return getTime(column, Calendar.getInstance());",
" public java.sql.Timestamp getTimestamp(int column, Calendar calendar)",
" throws SQLException {",
" agent_.logWriter_.traceEntry(",
" this, \"getTimestamp\", column, calendar);",
"",
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
"",
" // updateTimestamp() doesn't take a calendar, so the retrieved",
" // value will be in the default calendar. Convert it to",
" // the requested calendar before returning it.",
" result = convertFromDefaultCalendar(result, calendar);",
" } else if (!isNull(column)) {",
" result = cursor_.getTimestamp(column, calendar);"
],
"header": "@@ -954,57 +946,37 @@ public abstract class ResultSet implements java.sql.ResultSet,",
"removed": [
" public java.sql.Time getTime(int column, java.util.Calendar calendar) throws SQLException {",
" try",
" {",
" closeCloseFilterInputStream();",
"",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceEntry(this, \"getTime\", column, calendar);",
" }",
" java.sql.Time time = getTime(column);",
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.CALENDAR_IS_NULL));",
" }",
" if (time != null) {",
" java.util.Calendar targetCalendar = java.util.Calendar.getInstance(calendar.getTimeZone());",
" targetCalendar.clear();",
" targetCalendar.setTime(time);",
" java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();",
" defaultCalendar.clear();",
" defaultCalendar.setTime(time);",
" long timeZoneOffset =",
" targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +",
" targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);",
" time.setTime(time.getTime() - timeZoneOffset);",
" }",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceExit(this, \"getTime\", time);",
" }",
" return time;",
" }",
" catch ( SqlException se )",
" {",
" throw se.getSQLException();",
" }",
" public java.sql.Timestamp getTimestamp(int column) throws SQLException {",
" agent_.logWriter_.traceEntry(this, \"getTimestamp\", column);",
" } else {",
" result = isNull(column) ? null : cursor_.getTimestamp(column);"
]
}
]
}
] |
derby-DERBY-4582-9c285a72
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later when subsequently read with GMT calendar (Server Mode Only)
Added test case that exposes the bug. The test case currently only
passes with the embedded driver and is therefore not enabled in any
test suites.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@932930 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/TimeZoneTestSetup.java",
"hunks": [
{
"added": [
"/*",
" * Derby - Class org.apache.derbyTesting.functionTests.util.TimeZoneTestSetup",
" *",
" * 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.",
" */",
"",
"package org.apache.derbyTesting.junit;",
"",
"import java.util.TimeZone;",
"import junit.framework.Test;",
"",
"/**",
" * Decorator that changes the default timezone of the runtime environment",
" * for the duration of the test.",
" */",
"public class TimeZoneTestSetup extends BaseTestSetup {",
" /** Original timezone. */",
" private TimeZone savedDefault;",
" /** The timezone to use as default while running the test. */",
" private TimeZone requestedDefault;",
"",
" /**",
" * Wrap a test in a decorator that changes the default timezone.",
" * @param test the test to decorate",
" * @param timeZoneID the ID of the timezone to use",
" */",
" public TimeZoneTestSetup(Test test, String timeZoneID) {",
" this(test, TimeZone.getTimeZone(timeZoneID));",
" }",
"",
" /**",
" * Wrap a test in a decorator that changes the default timezone.",
" * @param test the test to decorate",
" * @param zone the timezone to use",
" */",
" public TimeZoneTestSetup(Test test, TimeZone zone) {",
" super(test);",
" this.requestedDefault = zone;",
" }",
"",
" /**",
" * Set the timezone.",
" */",
" protected void setUp() {",
" savedDefault = TimeZone.getDefault();",
" TimeZone.setDefault(requestedDefault);",
" }",
"",
" /**",
" * Reset the timezone.",
" */",
" protected void tearDown() {",
" TimeZone.setDefault(savedDefault);",
" savedDefault = null;",
" requestedDefault = null;",
" }",
"}"
],
"header": "@@ -0,0 +1,70 @@",
"removed": []
}
]
}
] |
derby-DERBY-4582-c1d0340b
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)
Partial fix. This check-in makes the client do the conversion to the
requested time zone correctly, and the correct timestamps will be sent
to the server. There's still some incorrect handling of the values on
the server, as well as when the client reads them back from the
server, so the results may still end up being wrong.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@935868 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/DateTime.java",
"hunks": [
{
"added": [
" DateTimeValue date)",
" int year = date.getYear();",
" int day = date.getDayOfMonth();"
],
"header": "@@ -264,16 +264,16 @@ public class DateTime {",
"removed": [
" java.sql.Date date) ",
" int year = date.getYear() + 1900;",
" int day = date.getDate();"
]
},
{
"added": [
" DateTimeValue time)"
],
"header": "@@ -311,7 +311,7 @@ public class DateTime {",
"removed": [
" java.sql.Time time)"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/am/PreparedStatement.java",
"hunks": [
{
"added": [
"import java.sql.Date;",
"import java.sql.Time;",
"import java.sql.Timestamp;",
"import java.util.Calendar;"
],
"header": "@@ -27,9 +27,13 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": []
},
{
"added": [
" public void setDate(int parameterIndex, Date x, Calendar calendar)",
" throws SQLException {",
" agent_.logWriter_.traceEntry(",
" this, \"setDate\", parameterIndex, x, calendar);"
],
"header": "@@ -718,12 +722,14 @@ public class PreparedStatement extends Statement",
"removed": [
" public void setDate(int parameterIndex, java.sql.Date x) throws SQLException {",
" agent_.logWriter_.traceEntry(this, \"setDate\", parameterIndex, x);"
]
},
{
"added": [
"",
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.INVALID_API_PARAMETER),",
" \"null\", \"calendar\", \"setDate()\");",
" }",
"",
" setInput(parameterIndex, new DateTimeValue(x, calendar));"
],
"header": "@@ -738,12 +744,19 @@ public class PreparedStatement extends Statement",
"removed": [
" setInput(parameterIndex, x);"
]
},
{
"added": [
" public void setDate(int parameterIndex, Date x) throws SQLException {",
" setDate(parameterIndex, x, Calendar.getInstance());",
" public void setTime(int parameterIndex, Time x, Calendar calendar)",
" throws SQLException {"
],
"header": "@@ -752,41 +765,12 @@ public class PreparedStatement extends Statement",
"removed": [
" public void setDate(int parameterIndex,",
" java.sql.Date x,",
" java.util.Calendar calendar) throws SQLException {",
" try",
" {",
" synchronized (connection_) {",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceEntry(this, \"setDate\", parameterIndex, x, calendar);",
" }",
" checkForClosedStatement();",
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_, ",
" new ClientMessageId(SQLState.INVALID_API_PARAMETER),",
" \"null\", \"calendar\", \"setDate\");",
" }",
" java.util.Calendar targetCalendar = java.util.Calendar.getInstance(calendar.getTimeZone());",
" targetCalendar.clear();",
" targetCalendar.setTime(x);",
" java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();",
" defaultCalendar.clear();",
" defaultCalendar.setTime(x);",
" long timeZoneOffset =",
" targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +",
" targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);",
" java.sql.Date adjustedDate = ((timeZoneOffset == 0) || (x == null)) ? x : new java.sql.Date(x.getTime() + timeZoneOffset);",
" setDate(parameterIndex, adjustedDate);",
" }",
" }",
" catch ( SqlException se )",
" {",
" throw se.getSQLException();",
" }",
" public void setTime(int parameterIndex, java.sql.Time x) throws SQLException {"
]
},
{
"added": [
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.INVALID_API_PARAMETER),",
" \"null\", \"calendar\", \"setTime()\");",
" }",
"",
" setInput(parameterIndex, new DateTimeValue(x, calendar));"
],
"header": "@@ -804,12 +788,18 @@ public class PreparedStatement extends Statement",
"removed": [
" setInput(parameterIndex, x);"
]
},
{
"added": [
" public void setTime(int parameterIndex, Time x) throws SQLException {",
" setTime(parameterIndex, x, Calendar.getInstance());",
" public void setTimestamp(int parameterIndex, Timestamp x, Calendar calendar)",
" throws SQLException {"
],
"header": "@@ -819,41 +809,12 @@ public class PreparedStatement extends Statement",
"removed": [
" public void setTime(int parameterIndex,",
" java.sql.Time x,",
" java.util.Calendar calendar) throws SQLException {",
" try",
" {",
" synchronized (connection_) {",
" if (agent_.loggingEnabled()) {",
" agent_.logWriter_.traceEntry(this, \"setTime\", parameterIndex, x, calendar);",
" }",
" checkForClosedStatement();",
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.INVALID_API_PARAMETER),",
" \"null\", \"calendar\", \"setTime()\");",
" }",
" java.util.Calendar targetCalendar = java.util.Calendar.getInstance(calendar.getTimeZone());",
" targetCalendar.clear();",
" targetCalendar.setTime(x);",
" java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();",
" defaultCalendar.clear();",
" defaultCalendar.setTime(x);",
" long timeZoneOffset =",
" targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +",
" targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);",
" java.sql.Time adjustedTime = ((timeZoneOffset == 0) || (x == null)) ? x : new java.sql.Time(x.getTime() + timeZoneOffset);",
" setTime(parameterIndex, adjustedTime);",
" }",
" }",
" catch ( SqlException se )",
" {",
" throw se.getSQLException();",
" }",
" public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException {"
]
},
{
"added": [
" if (calendar == null) {",
" throw new SqlException(agent_.logWriter_,",
" new ClientMessageId(SQLState.INVALID_API_PARAMETER),",
" \"null\", \"calendar\", \"setTimestamp()\");",
" }",
"",
" setInput(parameterIndex, new DateTimeValue(x, calendar));"
],
"header": "@@ -872,16 +833,19 @@ public class PreparedStatement extends Statement",
"removed": [
" setInput(parameterIndex, x);",
" // once the nanosecond field of timestamp is trim to microsecond for DERBY, should we throw a warning",
" //if (getParameterType (parameterIndex) == java.sql.Types.TIMESTAMP && x.getNanos() % 1000 != 0)",
" // accumulateWarning (new SqlWarning (agent_.logWriter_, \"DERBY timestamp can only store up to microsecond, conversion from nanosecond to microsecond causes rounding.\"));"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetStatementRequest.java",
"hunks": [
{
"added": [
"import java.sql.Date;",
"import java.sql.Time;",
"import java.sql.Timestamp;"
],
"header": "@@ -20,6 +20,9 @@",
"removed": []
},
{
"added": [
"import org.apache.derby.client.am.DateTimeValue;"
],
"header": "@@ -31,6 +34,7 @@ import org.apache.derby.client.am.Section;",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/client/net/Request.java",
"hunks": [
{
"added": [
"import org.apache.derby.client.am.DateTimeValue;"
],
"header": "@@ -32,6 +32,7 @@ import java.io.ObjectOutputStream;",
"removed": []
},
{
"added": [
" final void writeDate(DateTimeValue date) throws SqlException {"
],
"header": "@@ -1528,7 +1529,7 @@ public class Request {",
"removed": [
" final void writeDate(java.sql.Date date) throws SqlException {"
]
},
{
"added": [
" final void writeTime(DateTimeValue time) throws SqlException {"
],
"header": "@@ -1541,7 +1542,7 @@ public class Request {",
"removed": [
" final void writeTime(java.sql.Time time) throws SqlException {"
]
},
{
"added": [
" final void writeTimestamp(DateTimeValue timestamp) throws SqlException {"
],
"header": "@@ -1553,7 +1554,7 @@ public class Request {",
"removed": [
" final void writeTimestamp(java.sql.Timestamp timestamp) throws SqlException {"
]
}
]
}
] |
derby-DERBY-4582-e068569a
|
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)
Fixed test failure on small devices because the Foundation Profile 1.1
API doesn't include getYear(), getMonth(), etc, in java.util.Date. Use
java.util.Calendar to access those fields instead.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@939231 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4584-440c27c2
|
DERBY-4584: Unable to connect to network server if client thread name has Japanese characters
Patch contributed by Tiago R. Espinha.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@929085 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4587-0e72736f
|
DERBY-4587: Tools for improved analysis of query plans
This patch was contributed by C.S. Nirmal J. Fernando (nirmal070125 at gmail dot com)
This patch adds a check to see that the specified schema exists in the
database, cleans up the handling of the PrivilegedActionException when
security policy is not granted, and adds newline whitespace to the XML
output for the <stmt_id> and time fields.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@985762 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java",
"hunks": [
{
"added": [
" public boolean verifySchemaExistance() throws SQLException{",
" \tboolean found=false;",
" \tResultSet result = conn.getMetaData().getSchemas();",
" \twhile(result.next()){",
" \t\tif(result.getString(1).equals(schema)){",
" \t\t\tfound=true;",
" \t\t\tbreak;",
" \t\t}",
" \t}\t",
" \treturn found;",
" }"
],
"header": "@@ -125,6 +125,17 @@ public class AccessDatabase {",
"removed": []
},
{
"added": [
" return time+\"\\n\";"
],
"header": "@@ -474,7 +485,7 @@ public class AccessDatabase {",
"removed": [
" return time;"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/CreateXMLFile.java",
"hunks": [
{
"added": [
" throws IOException {"
],
"header": "@@ -55,7 +55,7 @@ public class CreateXMLFile {",
"removed": [
" throws IOException, PrivilegedActionException {"
]
},
{
"added": [
" DataOutputStream dos;",
"\t\ttry {",
"\t\t\tdos = new DataOutputStream("
],
"header": "@@ -68,8 +68,9 @@ public class CreateXMLFile {",
"removed": [
" DataOutputStream dos =",
" new DataOutputStream("
]
}
]
},
{
"file": "java/tools/org/apache/derby/tools/PlanExporter.java",
"hunks": [
{
"added": [
" ",
" if(access.verifySchemaExistance()){",
" ",
" \tif(access.initializeDataArray()){",
" \t\taccess.createXMLFragment();",
" \t\taccess.markTheDepth();",
" \t\tString stmt=access.statement();",
" \t\tString time=access.time();",
" \t\taccess.closeConnection();",
" \t\t//advanced XSL feature",
" \t\t//possible occurrences are",
" \t\t//-adv -xml {path} -xsl {path} or",
" \t\t//-adv -xsl {path} -xml {path}",
" \t\tif(args.length==8 &&",
" \t\t\t\targs[3].equalsIgnoreCase(\"-adv\")){",
" \t\t\tint opt1=selectArg(args[4]);",
" \t\t\tint opt2=selectArg(args[6]);",
" \t\t\tif(opt1==1 && opt2==3){",
" \t\t\t\tif(args[7].toUpperCase().endsWith(\".XSL\"))",
" \t\t\t\t\tgenerateXML(access,args[5],stmt,time,args[7]);",
" \t\t\t\telse",
" \t\t\t\t\tgenerateXML(access,args[5],stmt,time,args[7]+\".xsl\");",
" \t\t\t}",
" \t\t\telse if(opt1==3 && opt2==1){",
" \t\t\t\tif(args[5].toUpperCase().endsWith(\".XSL\"))",
" \t\t\t\t\tgenerateXML(access,args[7],stmt,time,args[5]);",
" \t\t\t\telse",
" \t\t\t\t\tgenerateXML(access,args[7],stmt,time,args[5]+\".xsl\");",
" \t\t\t}",
" \t\t\telse",
" \t\t\t\tprintHelp();",
" \t\t}",
" \t\t//possible occurrences are -xml {path} or -html {path}",
" \t\telse if(args.length==5){",
" \t\t\tint opt=selectArg(args[3]);",
" \t\t\tif(opt==0 || opt==3)",
" \t\t\t\tprintHelp();",
" \t\t\telse if(opt==1)",
" \t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
" \t\t\telse{",
" \t\t\t\tgenerateXML(access,\"temp.xml\",stmt,time,null);",
" \t\t\t\tgenerateHTML(\"temp.xml\",args[4],xslStyleSheetName,true);",
" \t\t\t\tdeleteFile(\"temp.xml\");",
" \t\t\t}",
" \t\t}",
" \t\t//possible occurrences are",
" \t\t//-xml {path} and -html {path}",
" \t\t//-html {path} and -xml {path}",
" \t\t//-html {path} and -xsl {path}",
" \t\t//-xsl {path} and -html {path}",
" \t\telse if(args.length==7){",
" \t\t\tint opt1=selectArg(args[3]);",
" \t\t\tint opt2=selectArg(args[5]);",
" \t\t\tif(opt1==0 || opt2==0)",
" \t\t\t\tprintHelp();",
" \t\t\telse if(opt1==1 && opt2==2){",
" \t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[4],args[6],xslStyleSheetName,true);",
" \t\t\t}",
" \t\t\telse if(opt1==2 && opt2==1){",
" \t\t\t\tgenerateXML(access,args[6],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[6],args[4],xslStyleSheetName,true);",
" \t\t\t}",
" \t\t\telse if(opt1==2 && opt2==3){",
" \t\t\t\tgenerateXML(access,\"temp.xml\",stmt,time,null);",
" \t\t\t\tgenerateHTML(\"temp.xml\",args[4],args[6],false);",
" \t\t\t\tdeleteFile(\"temp.xml\");",
" \t\t\t}",
" \t\t\telse if(opt1==3 && opt2==2){",
" \t\t\t\tgenerateXML(access,\"temp.xml\",stmt,time,null);",
" \t\t\t\tgenerateHTML(\"temp.xml\",args[6],args[4],false);",
" \t\t\t\tdeleteFile(\"temp.xml\");",
" \t\t\t}",
" \t\t\telse",
" \t\t\t\tprintHelp();",
" \t\t}",
" \t\t//possible occurrences are",
" \t\t//-xml {path} and -html {path} and -xsl {path}",
" \t\t//-html {path} and -xsl {path} and -xml {path}",
" \t\t//-xsl {path} and -xml {path} and -html {path}",
" \t\t//-xml {path} and -xsl {path} and -html {path}",
" \t\t//-html {path} and -xml {path} and -xsl {path}",
" \t\t//-xsl {path} and -html {path} and -xml {path}",
" \t\telse if(args.length==9){",
" \t\t\tint opt1=selectArg(args[3]);",
" \t\t\tint opt2=selectArg(args[5]);",
" \t\t\tint opt3=selectArg(args[7]);",
" \t\t\tif(opt1==0 || opt2==0 || opt3==0)",
" \t\t\t\tprintHelp();",
" \t\t\telse if(opt1==1 && opt2==2 && opt3==3){",
" \t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[4],args[6],args[8],false);",
" \t\t\t}",
" \t\t\telse if(opt1==2 && opt2==3 && opt3==1){",
" \t\t\t\tgenerateXML(access,args[8],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[8],args[4],args[6],false);",
" \t\t\t}",
" \t\t\telse if(opt1==3 && opt2==1 && opt3==2){",
" \t\t\t\tgenerateXML(access,args[6],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[6],args[8],args[4],false);",
" \t\t\t}",
" \t\t\telse if(opt1==1 && opt2==3 && opt3==2){",
" \t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[4],args[8],args[6],false);",
" \t\t\t}",
" \t\t\telse if(opt1==2 && opt2==1 && opt3==3){",
" \t\t\t\tgenerateXML(access,args[6],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[6],args[4],args[8],false);",
" \t\t\t}",
" \t\t\telse if(opt1==3 && opt2==2 && opt3==1){",
" \t\t\t\tgenerateXML(access,args[8],stmt,time,null);",
" \t\t\t\tgenerateHTML(args[8],args[6],args[4],false);",
" \t\t\t}",
" \t\t\telse",
" \t\t\t\tprintHelp();",
" \t\t}",
" \t\telse",
" \t\t\tprintHelp();",
" \t}",
" \telse{",
" \t\tSystem.out.println(",
" \t\t\t\t\"====================================================\\n\" +",
" \t\t\t\t\"--- An Error Occured: No Statistics has Captured ---\\n\" +",
" \t\t\t\t\"-- Possible reasons: --\\n\" +",
" \t\t\t\t\"-- 1) The statement executed is a DDL statement. --\\n\" +",
" \t\t\t\t\"-- Statistics will not capture for DDL statements --\\n\" +",
" \t\t\t\t\"-- by the Derby. --\\n\" +",
" \t\t\t\t\"-- 2) The statement ID entered is incorrect. --\\n\" +",
" \t\t\t\t\"-- 3) Schema specified does not exist. --\\n\" +",
" \t\t\t\t\"====================================================\\n\"",
" \t\t);",
" \t}",
" \tSystem.out.println(",
" \t\t\t\t\"====================================================\\n\" +",
" \t\t\t\t\"--- An Error Occured: ---\\n\" +",
" \t\t\t\t\"------- Specified Schema does not exist. -------\\n\" +",
" \t\t\t\t\"======================================================\");"
],
"header": "@@ -53,134 +53,146 @@ public class PlanExporter {",
"removed": [
" if(access.initializeDataArray()){",
" access.createXMLFragment();",
" access.markTheDepth();",
" String stmt=access.statement();",
" String time=access.time();",
" access.closeConnection();",
" //advanced XSL feature",
" //possible occurrences are",
" //-adv -xml {path} -xsl {path} or",
" //-adv -xsl {path} -xml {path}",
" if(args.length==8 &&",
" args[3].equalsIgnoreCase(\"-adv\")){",
" int opt1=selectArg(args[4]);",
" int opt2=selectArg(args[6]);",
" if(opt1==1 && opt2==3){",
" if(args[7].toUpperCase().endsWith(\".XSL\"))",
" generateXML(access,args[5],stmt,time,args[7]);",
" else",
" generateXML(access,args[5],stmt,time,args[7]+\".xsl\");",
" }",
" else if(opt1==3 && opt2==1){",
" if(args[5].toUpperCase().endsWith(\".XSL\"))",
" generateXML(access,args[7],stmt,time,args[5]);",
" else",
" generateXML(access,args[7],stmt,time,args[5]+\".xsl\");",
" }",
" else",
" printHelp();",
" }",
" //possible occurrences are -xml {path} or -html {path}",
" else if(args.length==5){",
" int opt=selectArg(args[3]);",
" if(opt==0 || opt==3)",
" printHelp();",
" else if(opt==1)",
" generateXML(access,args[4],stmt,time,null);",
" else{",
" generateXML(access,\"temp.xml\",stmt,time,null);",
" generateHTML(\"temp.xml\",args[4],xslStyleSheetName,true);",
" deleteFile(\"temp.xml\");",
" }",
" }",
" //possible occurrences are",
" //-xml {path} and -html {path}",
" //-html {path} and -xml {path}",
" //-html {path} and -xsl {path}",
" //-xsl {path} and -html {path}",
" else if(args.length==7){",
" int opt1=selectArg(args[3]);",
" int opt2=selectArg(args[5]);",
" if(opt1==0 || opt2==0)",
" printHelp();",
" else if(opt1==1 && opt2==2){",
" generateXML(access,args[4],stmt,time,null);",
" generateHTML(args[4],args[6],xslStyleSheetName,true);",
" }",
" else if(opt1==2 && opt2==1){",
" generateXML(access,args[6],stmt,time,null);",
" generateHTML(args[6],args[4],xslStyleSheetName,true);",
" }",
" else if(opt1==2 && opt2==3){",
" generateXML(access,\"temp.xml\",stmt,time,null);",
" generateHTML(\"temp.xml\",args[4],args[6],false);",
" deleteFile(\"temp.xml\");",
" }",
" else if(opt1==3 && opt2==2){",
" generateXML(access,\"temp.xml\",stmt,time,null);",
" generateHTML(\"temp.xml\",args[6],args[4],false);",
" deleteFile(\"temp.xml\");",
" }",
" else",
" printHelp();",
" }",
" //possible occurrences are",
" //-xml {path} and -html {path} and -xsl {path}",
" //-html {path} and -xsl {path} and -xml {path}",
" //-xsl {path} and -xml {path} and -html {path}",
" //-xml {path} and -xsl {path} and -html {path}",
" //-html {path} and -xml {path} and -xsl {path}",
" //-xsl {path} and -html {path} and -xml {path}",
" else if(args.length==9){",
" int opt1=selectArg(args[3]);",
" int opt2=selectArg(args[5]);",
" int opt3=selectArg(args[7]);",
" if(opt1==0 || opt2==0 || opt3==0)",
" printHelp();",
" else if(opt1==1 && opt2==2 && opt3==3){",
" generateXML(access,args[4],stmt,time,null);",
" generateHTML(args[4],args[6],args[8],false);",
" }",
" else if(opt1==2 && opt2==3 && opt3==1){",
" generateXML(access,args[8],stmt,time,null);",
" generateHTML(args[8],args[4],args[6],false);",
" }",
" else if(opt1==3 && opt2==1 && opt3==2){",
" generateXML(access,args[6],stmt,time,null);",
" generateHTML(args[6],args[8],args[4],false);",
" }",
" else if(opt1==1 && opt2==3 && opt3==2){",
" generateXML(access,args[4],stmt,time,null);",
" generateHTML(args[4],args[8],args[6],false);",
" }",
" else if(opt1==2 && opt2==1 && opt3==3){",
" generateXML(access,args[6],stmt,time,null);",
" generateHTML(args[6],args[4],args[8],false);",
" }",
" else if(opt1==3 && opt2==2 && opt3==1){",
" generateXML(access,args[8],stmt,time,null);",
" generateHTML(args[8],args[6],args[4],false);",
" }",
" else",
" printHelp();",
" }",
" else",
" printHelp();",
" System.out.println(",
" \"====================================================\\n\" +",
" \"--- An Error Occured: No Statistics has Captured ---\\n\" +",
" \"-- Possible reasons: --\\n\" +",
" \"-- 1) The statement executed is a DDL statement. --\\n\" +",
" \"-- Statistics will not capture for DDL statements --\\n\" +",
" \"-- by the Derby. --\\n\" +",
" \"-- 2) The statement ID entered is incorrect. --\\n\" +",
" \"====================================================\\n\"",
" );"
]
}
]
}
] |
derby-DERBY-4587-82d65861
|
DERBY-4587: Add tools for improved analysis and understanding of query plans and execution statistics
Various clean-ups and improvements, amongst others:
o print statement id in the output
o print time of statement execution in the output
o removed user and password arguments for PlanExporter (specified in JDBC URL instead)
o close connection instead of shutting down database
o removed @author tags
o made TreeNode package-private
o switched depth-representation from String to int
Patch contributed by C.S. Nirmal J. Fernando (nirmal070125 at gmail dot com).
Patch file: DERBY-4587-tool-9.8-modified.diff
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@984881 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java",
"hunks": [
{
"added": [],
"header": "@@ -12,11 +12,6 @@ import java.sql.ResultSet;",
"removed": [
"",
"/**",
" * @author Nirmal",
" *",
" */"
]
},
{
"added": [
"\t/**",
"\t * @param query the stmt_id to set",
"\t */",
"\tpublic void setQuery(String query) {",
"\t\tthis.query = query;",
"\t}",
"",
"\t/**",
"\t * @return the stmt_id",
"\t */",
"\tpublic String getQuery() {",
"\t\treturn query;",
"\t}"
],
"header": "@@ -25,6 +20,19 @@ public class AccessDatabase {",
"removed": []
},
{
"added": [
"\tprivate static final int ID =0 ;",
"\tprivate static final int P_ID =1;",
"\tprivate static final int NODE_TYPE=2;",
"\tprivate static final int NO_OF_OPENS=3;",
"\tprivate static final int INPUT_ROWS=4;",
"\tprivate static final int RETURNED_ROWS=5;",
"\tprivate static final int VISITED_PAGES=6;",
"\tprivate static final int SCAN_QUALIFIERS=7;",
"\tprivate static final int NEXT_QUALIFIERS=8;",
"\tprivate static final int SCANNED_OBJECT=9;",
"\tprivate static final int SCAN_TYPE=10;",
"\tprivate static final int SORT_TYPE=11;",
"\tprivate static final int NO_OF_OUTPUT_ROWS_BY_SORTER=12;"
],
"header": "@@ -32,19 +40,19 @@ public class AccessDatabase {",
"removed": [
"\tprivate final int id =0 ;",
"\tprivate final int p_id =1;",
"\tprivate final int nodeType=2;",
"\tprivate final int noOfOpens=3;",
"\tprivate final int inputRows=4;",
"\tprivate final int returnedRows=5;",
"\tprivate final int visitedPages=6;",
"\tprivate final int scanQualifiers=7;",
"\tprivate final int nextQualifiers=8;",
"\tprivate final int scannedObject=9;",
"\tprivate final int scanType=10;",
"\tprivate final int sortType=11;",
"\tprivate final int noOfOutputRowsBySorter=12;"
]
},
{
"added": [
"\t\tsetQuery(aQuery);"
],
"header": "@@ -57,7 +65,7 @@ public class AccessDatabase {",
"removed": [
"\t\tquery = aQuery;"
]
},
{
"added": [
"\t *",
"\t\tsetQuery(aQuery);"
],
"header": "@@ -66,12 +74,13 @@ public class AccessDatabase {",
"removed": [
"\t\tquery = aQuery;"
]
},
{
"added": [
"\t\tif(dbURL.indexOf(\"://\") != -1)"
],
"header": "@@ -85,7 +94,7 @@ public class AccessDatabase {",
"removed": [
"\t\tif(dbURL.indexOf(\"//\") != -1)"
]
},
{
"added": [
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", ID);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", P_ID);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", NODE_TYPE);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", NO_OF_OPENS);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", INPUT_ROWS);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", RETURNED_ROWS);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", VISITED_PAGES);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", SCAN_QUALIFIERS);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", NEXT_QUALIFIERS);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", SCANNED_OBJECT);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", SCAN_TYPE);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", SORT_TYPE);",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\", NO_OF_OUTPUT_ROWS_BY_SORTER);",
"\t * Generating the XML tree",
"\t\t\tif(data[i].getDepth()==0){//root element"
],
"header": "@@ -107,96 +116,96 @@ public class AccessDatabase {",
"removed": [
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", id);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", p_id);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", nodeType);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", noOfOpens);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", inputRows);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", returnedRows);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", visitedPages);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", scanQualifiers);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", nextQualifiers);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", scannedObject);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", scanType);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", sortType);",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\", noOfOutputRowsBySorter);",
"\t * ",
"\t\t\tif(Integer.parseInt(data[i].getDepth())==0){//root element"
]
},
{
"added": [
"\tprivate void getChildren(int currentLevel,String id ){",
"\t\t\t\tif(data[i].getDepth()== currentLevel &&"
],
"header": "@@ -212,10 +221,10 @@ public class AccessDatabase {",
"removed": [
"\tpublic void getChildren(int currentLevel,String id ){",
"\t\t\t\tif(Integer.parseInt(data[i].getDepth())== currentLevel &&"
]
},
{
"added": [
"\t\tdata[i].setDepth(depth); //root"
],
"header": "@@ -247,7 +256,7 @@ public class AccessDatabase {",
"removed": [
"\t\tdata[i].setDepth(\"\"+depth); //root"
]
},
{
"added": [
"\tprivate void findChildren(int idx, int dep) {"
],
"header": "@@ -256,7 +265,7 @@ public class AccessDatabase {",
"removed": [
"\tpublic void findChildren(int idx, int dep) {"
]
},
{
"added": [
"\t\t\t\t\tdata[i].setDepth(dep +1);"
],
"header": "@@ -266,7 +275,7 @@ public class AccessDatabase {",
"removed": [
"\t\t\t\t\tdata[i].setDepth(\"\"+(dep +1));"
]
},
{
"added": [
"\t\t\t\tcase ID: ",
"\t\t\t\tcase P_ID:",
"\t\t\t\tcase NODE_TYPE:",
"\t\t\t\tcase NO_OF_OPENS:",
"\t\t\t\tcase INPUT_ROWS:",
"\t\t\t\tcase RETURNED_ROWS:",
"\t\t\t\tcase VISITED_PAGES:",
"\t\t\t\tcase SCAN_QUALIFIERS:",
"\t\t\t\tcase NEXT_QUALIFIERS:",
"\t\t\t\tcase SCANNED_OBJECT:",
"\t\t\t\tcase SCAN_TYPE:",
"\t\t\t\tcase SORT_TYPE:",
"\t\t\t\tcase NO_OF_OUTPUT_ROWS_BY_SORTER:"
],
"header": "@@ -308,43 +317,43 @@ public class AccessDatabase {",
"removed": [
"\t\t\t\tcase id: ",
"\t\t\t\tcase p_id:",
"\t\t\t\tcase nodeType:",
"\t\t\t\tcase noOfOpens:",
"\t\t\t\tcase inputRows:",
"\t\t\t\tcase returnedRows:",
"\t\t\t\tcase visitedPages:",
"\t\t\t\tcase scanQualifiers:",
"\t\t\t\tcase nextQualifiers:",
"\t\t\t\tcase scannedObject:",
"\t\t\t\tcase scanType:",
"\t\t\t\tcase sortType:",
"\t\t\t\tcase noOfOutputRowsBySorter:"
]
},
{
"added": [
"\t\t\t\t * P_ID can be null at the root.",
"\t\t\t\tcase P_ID:"
],
"header": "@@ -352,10 +361,10 @@ public class AccessDatabase {",
"removed": [
"\t\t\t\t * p_id can be null at the root.",
"\t\t\t\tcase p_id:"
]
},
{
"added": [
"\tprivate int noOfNodes() throws SQLException{",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\");"
],
"header": "@@ -371,13 +380,13 @@ public class AccessDatabase {",
"removed": [
"\tpublic int noOfNodes() throws SQLException{",
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\");"
]
},
{
"added": [
"\t * @return the <statement> element"
],
"header": "@@ -388,7 +397,7 @@ public class AccessDatabase {",
"removed": [
"\t * @return the <statement> element"
]
},
{
"added": [
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\");"
],
"header": "@@ -396,7 +405,7 @@ public class AccessDatabase {",
"removed": [
"\t\t\t\t\"where STMT_ID = '\"+query+\"'\");"
]
},
{
"added": [
"\tprivate String replace(String stmt, String expr, String replace){"
],
"header": "@@ -419,7 +428,7 @@ public class AccessDatabase {",
"removed": [
"\tpublic String replace(String stmt, String expr, String replace){"
]
},
{
"added": [
"\t",
"\t/**",
"\t * ",
"\t * @return XPLAIN_TIME of SYSXPLAIN_STATEMENTS",
"\t * @throws SQLException",
"\t */",
"\tpublic String time() throws SQLException{",
"\t\tstmt = conn.createStatement();",
"\t\tResultSet results = stmt.executeQuery(",
"\t\t\t\t\"select '<time>'||TRIM(CHAR(XPLAIN_TIME))||\" +",
"\t\t\t\t\"'</time>' from \"+schema+\".SYSXPLAIN_STATEMENTS \" +",
"\t\t\t\t\"where STMT_ID = '\"+getQuery()+\"'\");",
"\t\tresults.next();",
"\t\tString time = results.getString(1);",
"\t\tresults.close();",
"\t\tstmt.close();",
"\t\t",
"\t\treturn time;",
"\t}",
"\t",
"\t/**",
"\t * ",
"\t * @return stmt_id as a XML element",
"\t */",
"\tpublic String stmtID(){",
"\t\treturn \"<stmt_id>\"+getQuery()+\"</stmt_id>\";",
"\t}",
"\t * closing the connection to the database",
"\tpublic void closeConnection()"
],
"header": "@@ -428,11 +437,38 @@ public class AccessDatabase {",
"removed": [
"\t * shut downing the connection to the database",
"\tpublic void shutdown()"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/CreateHTMLFile.java",
"hunks": [
{
"added": [
"/**",
" * This class is used by PlanExporter tool (DERBY-4587)",
" * in order to create HTML output of a query plan",
" * using a plain XSL style sheet and a XML data of",
" * a query plan.",
" */",
"\t\tif(!(HTMLFile.toUpperCase()).endsWith(\".HTML\"))"
],
"header": "@@ -9,12 +9,18 @@ import java.io.File;",
"removed": [
"\t\tif(!HTMLFile.endsWith(\".html\") && !HTMLFile.endsWith(\".HTML\"))"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/CreateXMLFile.java",
"hunks": [
{
"added": [],
"header": "@@ -16,10 +16,6 @@ import java.security.AccessController;",
"removed": [
"/**",
" * @author Nirmal",
" *",
" */"
]
},
{
"added": [
"\t * @param stmt statement executed",
"\t * @param time time which the statement was executed ",
"\t * @throws PrivilegedActionException ",
"\tpublic void writeTheXMLFile(String stmt, String time,",
"\tthrows IOException, PrivilegedActionException {",
"\t\tString comment = \"<!-- Apache Derby Query Explainer (DERBY-4587)-->\\n\";"
],
"header": "@@ -29,26 +25,26 @@ public class CreateXMLFile {",
"removed": [
"\t * ",
"\tpublic void writeTheXMLFile(String stmt, ",
"\tthrows PrivilegedActionException, IOException {",
"\t\tString comment = \"<!-- Designed & coded by C.S.Nirmal J. Fernando,\" +",
"\t\t\" of University of Moratuwa, Sri Lanka, to Apache \" +",
"\t\t\"Derby Query Explainer (DERBY-4587)-->\\n\";"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/TreeNode.java",
"hunks": [
{
"added": [
"/**",
" * This class is used by PlanExporter tool (DERBY-4587)",
" * as a data structure to keep the values retrieved",
" * after querying XPLAIN tables and few other properties",
" * of a plan node in a query plan.",
" */",
"class TreeNode{"
],
"header": "@@ -1,6 +1,12 @@",
"removed": [
"public class TreeNode extends Object{"
]
},
{
"added": [
"\tprivate int depth ;"
],
"header": "@@ -15,7 +21,7 @@ public class TreeNode extends Object{",
"removed": [
"\tprivate String depth ;"
]
},
{
"added": [
"\tpublic void setDepth(int depth) {",
"\tpublic int getDepth() {"
],
"header": "@@ -105,13 +111,13 @@ public class TreeNode extends Object{",
"removed": [
"\tpublic void setDepth(String depth) {",
"\tpublic String getDepth() {"
]
},
{
"added": [
"\t\tString details = \"<node \";"
],
"header": "@@ -191,7 +197,7 @@ public class TreeNode extends Object{",
"removed": [
"\t\tString details = new String(\"<node \");"
]
}
]
},
{
"file": "java/tools/org/apache/derby/tools/PlanExporter.java",
"hunks": [
{
"added": [
"\tprivate static final int XML=1;",
"\tprivate static final int HTML=2;",
"\tprivate static final int XSL=3;",
"\t * 1) database URL eg: jdbc:derby:myDB ---------",
"\t * 2) database schema -----------------------------",
"\t * 3) statement ID (36 characters) ----------------",
"\t\t\tif(args.length>4 && args.length<10 ){",
"\t\t\t\tdbURL = args[0];",
"\t\t\t\tAccessDatabase access = new AccessDatabase(dbURL, args[1], args[2]);",
"\t\t\t\t\tString time=access.time();",
"\t\t\t\t\taccess.closeConnection();",
"\t\t\t\t\tif(args.length==8 && ",
"\t\t\t\t\t\targs[3].equalsIgnoreCase(\"-adv\")){",
"\t\t\t\t\t\tint opt1=selectArg(args[4]);",
"\t\t\t\t\t\tint opt2=selectArg(args[6]);",
"\t\t\t\t\t\t\tif(args[7].toUpperCase().endsWith(\".XSL\"))",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[5],stmt,time,args[7]);",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[5],stmt,time,args[7]+\".xsl\");",
"\t\t\t\t\t\t\tif(args[5].toUpperCase().endsWith(\".XSL\"))",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[7],stmt,time,args[5]);",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[7],stmt,time,args[5]+\".xsl\");",
"\t\t\t\t\telse if(args.length==5){",
"\t\t\t\t\t\tint opt=selectArg(args[3]);",
"\t\t\t\t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateXML(access,\"temp.xml\",stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(\"temp.xml\",args[4],xslStyleSheetName,true);"
],
"header": "@@ -10,77 +10,69 @@ import org.apache.derby.impl.tools.planexporter.AccessDatabase;",
"removed": [
"/**",
" * @author Nirmal",
" *",
" */",
"\tprivate static final int xml=1;",
"\tprivate static final int html=2;",
"\tprivate static final int xsl=3;",
"\t * 1) database string eg: jdbc:derby:myDB --------- ",
"\t * 2) username ------------------------------------",
"\t * 3) password ------------------------------------",
"\t * 4) database schema -----------------------------",
"\t * 5) statement ID (36 characters) ----------------",
"\t\t\tif(args.length>6 && args.length<12 ){",
"\t\t\t\tdbURL = args[0]+\";create=false\"+",
"\t\t\t\t\";user=\"+args[1]+\";password=\"+args[2];",
"\t\t\t\tAccessDatabase access = new AccessDatabase(dbURL, args[3], args[4]);",
"\t\t\t\t\taccess.shutdown();",
"\t\t\t\t\tif(args.length==10 && ",
"\t\t\t\t\t\targs[5].equalsIgnoreCase(\"-adv\")){",
"\t\t\t\t\t\tint opt1=selectArg(args[6]);",
"\t\t\t\t\t\tint opt2=selectArg(args[8]);",
"\t\t\t\t\t\t\tif(args[9].endsWith(\".xsl\")||",
"\t\t\t\t\t\t\t\t\targs[9].endsWith(\".XSL\"))",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[7],stmt,args[9]);",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[7],stmt,args[9]+\".xsl\");",
"\t\t\t\t\t\t\tif(args[7].endsWith(\".xsl\")||",
"\t\t\t\t\t\t\t\t\targs[7].endsWith(\".XSL\"))",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[9],stmt,args[7]);",
"\t\t\t\t\t\t\t\tgenerateXML(access,args[9],stmt,args[7]+\".xsl\");",
"\t\t\t\t\telse if(args.length==7){",
"\t\t\t\t\t\tint opt=selectArg(args[5]);",
"\t\t\t\t\t\t\tgenerateXML(access,args[6],stmt,null);",
"\t\t\t\t\t\t\tgenerateXML(access,\"temp.xml\",stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(\"temp.xml\",args[6],xslStyleSheetName,true);"
]
},
{
"added": [
"\t\t\t\t\telse if(args.length==7){",
"\t\t\t\t\t\tint opt1=selectArg(args[3]);",
"\t\t\t\t\t\tint opt2=selectArg(args[5]);",
"\t\t\t\t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[4],args[6],xslStyleSheetName,true);",
"\t\t\t\t\t\t\tgenerateXML(access,args[6],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[6],args[4],xslStyleSheetName,true);",
"\t\t\t\t\t\t\tgenerateXML(access,\"temp.xml\",stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(\"temp.xml\",args[4],args[6],false);",
"\t\t\t\t\t\t\tgenerateXML(access,\"temp.xml\",stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(\"temp.xml\",args[6],args[4],false);"
],
"header": "@@ -89,27 +81,27 @@ public class PlanExporter {",
"removed": [
"\t\t\t\t\telse if(args.length==9){",
"\t\t\t\t\t\tint opt1=selectArg(args[5]);",
"\t\t\t\t\t\tint opt2=selectArg(args[7]);",
"\t\t\t\t\t\t\tgenerateXML(access,args[6],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[6],args[8],xslStyleSheetName,true);",
"\t\t\t\t\t\t\tgenerateXML(access,args[8],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[8],args[6],xslStyleSheetName,true);",
"\t\t\t\t\t\t\tgenerateXML(access,\"temp.xml\",stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(\"temp.xml\",args[6],args[8],false);",
"\t\t\t\t\t\t\tgenerateXML(access,\"temp.xml\",stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(\"temp.xml\",args[8],args[6],false);"
]
},
{
"added": [
"\t\t\t\t\telse if(args.length==9){",
"\t\t\t\t\t\tint opt1=selectArg(args[3]);",
"\t\t\t\t\t\tint opt2=selectArg(args[5]);",
"\t\t\t\t\t\tint opt3=selectArg(args[7]);",
"\t\t\t\t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[4],args[6],args[8],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[8],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[8],args[4],args[6],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[6],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[6],args[8],args[4],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[4],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[4],args[8],args[6],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[6],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[6],args[4],args[8],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[8],stmt,time,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[8],args[6],args[4],false);",
"\t\t\t\t\t}\t",
"\t\t\t\t\telse",
"\t\t\t\t\t\tprintHelp();"
],
"header": "@@ -122,39 +114,41 @@ public class PlanExporter {",
"removed": [
"\t\t\t\t\telse{",
"\t\t\t\t\t\tint opt1=selectArg(args[5]);",
"\t\t\t\t\t\tint opt2=selectArg(args[7]);",
"\t\t\t\t\t\tint opt3=selectArg(args[9]);",
"\t\t\t\t\t\t\tgenerateXML(access,args[6],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[6],args[8],args[10],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[10],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[10],args[6],args[8],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[8],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[8],args[10],args[6],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[6],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[6],args[10],args[8],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[8],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[8],args[6],args[10],false);",
"\t\t\t\t\t\t\tgenerateXML(access,args[10],stmt,null);",
"\t\t\t\t\t\t\tgenerateHTML(args[10],args[8],args[6],false);",
"\t\t\t\t\t}\t\t\t\t\t"
]
},
{
"added": [
"\t\t\telse",
"\t\t\t"
],
"header": "@@ -169,9 +163,9 @@ public class PlanExporter {",
"removed": [
"\t\t\telse{",
"\t\t\t}"
]
},
{
"added": [
"\t\t\treturn XML;",
"\t\t\treturn HTML;",
"\t\t\treturn XSL;"
],
"header": "@@ -184,11 +178,11 @@ public class PlanExporter {",
"removed": [
"\t\t\treturn xml;",
"\t\t\treturn html;",
"\t\t\treturn xsl;"
]
},
{
"added": [
"\t * @param time time which the statement was executed",
"\t\t\tString arg, String stmt, String time, String xsl) throws Exception{",
"\t\tif(arg.toUpperCase().endsWith(\".XML\")){",
"\t\t\txmlFile.writeTheXMLFile(stmt, time,",
"\t\t\txmlFile.writeTheXMLFile(stmt, time,"
],
"header": "@@ -198,20 +192,21 @@ public class PlanExporter {",
"removed": [
"\t\t\tString arg, String stmt,String xsl) throws Exception{",
"\t\tif(arg.endsWith(\".xml\") || arg.endsWith(\".XML\")){",
"\t\t\txmlFile.writeTheXMLFile(stmt,",
"\t\t\txmlFile.writeTheXMLFile(stmt,"
]
},
{
"added": [
"\t\tif(arg.toUpperCase().endsWith(\".XML\")){"
],
"header": "@@ -230,7 +225,7 @@ public class PlanExporter {",
"removed": [
"\t\tif(arg.endsWith(\".xml\") || arg.endsWith(\".XML\")){"
]
},
{
"added": [
"\t\t\t\t\"-- You can pass 5 arguments (minimum), or --\\n\" +",
"\t\t\t\t\"-- 7 arguments or 8 arguments or --\\n\" +",
"\t\t\t\t\"----------- 9 arguments (maximum) ------------\\n\" +",
"\t\t\t\t\"1) database URL --------------------------------\\n\" +",
"\t\t\t\t\"2) database schema -----------------------------\\n\" +",
"\t\t\t\t\"3) statement ID (36 characters) ----------------\\n\" +",
"\t\t\t\t\"a) -xml {pathToXML} or -html {pathToHTML} ------\\n\" +",
"\t\t\t\t\"b) -xml {pathToXML} -html {pathToHTML} ---------\\n\" +",
"\t\t\t\t\"c) -xsl {pathToXSL} -html {pathToHTML} ---------\\n\" +",
"\t\t\t\t\"d) -xml {pathToXML} -xsl {pathToXSL} -----------\\n\" +",
"\t\t\t\t\"e) -adv -xml {pathToXML} -xsl {pathToXSL} ------\\n\" +",
"\tprivate static void deleteFile(final String fileName) "
],
"header": "@@ -243,29 +238,27 @@ public class PlanExporter {",
"removed": [
"\t\t\t\t\"-- You can pass 7 arguments (minimum), or --\\n\" +",
"\t\t\t\t\"-- 9 arguments or 10 arguments or --\\n\" +",
"\t\t\t\t\"----------- 11 arguments (maximum) -----------\\n\" +",
"\t\t\t\t\"1) database string eg: jdbc:derby:myDB ---------\\n\" +",
"\t\t\t\t\"2) username ------------------------------------\\n\" +",
"\t\t\t\t\"3) password ------------------------------------\\n\" +",
"\t\t\t\t\"4) database schema -----------------------------\\n\" +",
"\t\t\t\t\"5) statement ID (36 characters) ----------------\\n\" +",
"\t\t\t\t\"6) -xml {pathToXML} or -html {pathToHTML} ------\\n\" +",
"\t\t\t\t\"7) -xml {pathToXML} -html {pathToHTML} ---------\\n\" +",
"\t\t\t\t\"8) -xsl {pathToXSL} -html {pathToHTML} ---------\\n\" +",
"\t\t\t\t\"9) -xml {pathToXML} -xsl {pathToXSL} -----------\\n\" +",
"\t\t\t\t\"10) -adv -xml {pathToXML} -xsl {pathToXSL} -----\\n\" +",
"\tpublic static void deleteFile(final String fileName) "
]
}
]
}
] |
derby-DERBY-4587-b1b255cc
|
DERBY-4781 (partial) Fix XplainStatisticsTest failure with J2ME on split method
introduced by DERBY-4587
Contributed by C.S. Nirmal J Fernando ( nirmal070125 at gmail dot com )
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@988264 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java",
"hunks": [
{
"added": [
" \tif(stmt.indexOf(expr)!=-1){",
" \t\tstmt=stmt.substring(0, stmt.indexOf(expr))",
" \t\t+replace+stmt.substring(stmt.indexOf(expr)+1);",
" \t\treplace(stmt,expr,replace);",
" \t\treturn \"\";",
" \t}",
" \telse{",
" \t\treturn stmt;",
" \t}",
" "
],
"header": "@@ -460,15 +460,17 @@ public class AccessDatabase {",
"removed": [
" String[] part=stmt.split(expr);",
" String newStmt= part[0];",
" for(int i=1;i<part.length;i++){",
" newStmt += \" \"+replace+\" \"+part[i];",
" }",
"",
" return newStmt;",
""
]
}
]
}
] |
derby-DERBY-4587-fb74f094
|
DERBY-4587: Add tools for improved analysis of query plans
This patch was contributed by Nirmal Fernando (nirmal070125 at gmail dot com)
This patch changes the comment markers in the XSL files from slash-star
to lessthan-bang-dash-dash, and updates a javadoc comment and a variable
name in CreateHTMLFile.java.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@985075 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/planexporter/CreateHTMLFile.java",
"hunks": [
{
"added": [
"\t",
"\tprivate static String xslStyleSheetName =\"resources/vanilla_html.xsl\";//default xsl",
"\t/**",
"\t * ",
"\t * @param XMLFileName name of the XML file",
"\t * @param XSLSheetName name of the XSL file",
"\t * @param HTMLFile name of the HTML file",
"\t * @param def whether to use the default XSL or not",
"\t * @throws Exception",
"\t */"
],
"header": "@@ -37,7 +37,17 @@ import java.net.URL;",
"removed": []
}
]
}
] |
derby-DERBY-4588-992b79d1
|
DERBY-4588 Provide a diagnostic property that will print a stack trace on succes
sful boot to help diagnose dual boot issues after the DERBY-700 fix
To use, set the property derby.stream.error.logBootTrace=true
A stack trace will print in the derby.log on boot and shutdown.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@934996 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java",
"hunks": [
{
"added": [
" boolean logBootTrace = Boolean.valueOf(startParams.getProperty(Property.LOG_BOOT_TRACE,",
" PropertyUtil.getSystemProperty(Property.LOG_BOOT_TRACE))).booleanValue();"
],
"header": "@@ -354,7 +354,8 @@ public class BaseDataFileFactory",
"removed": [
""
]
},
{
"added": [
" if (logBootTrace)",
" Monitor.logThrowable(new Throwable(\"boot trace\"));"
],
"header": "@@ -364,6 +365,8 @@ public class BaseDataFileFactory",
"removed": []
},
{
"added": [
"\t\tboolean logBootTrace = PropertyUtil.getSystemBoolean(Property.LOG_BOOT_TRACE);"
],
"header": "@@ -461,6 +464,7 @@ public class BaseDataFileFactory",
"removed": []
},
{
"added": [
"\t",
"\t\tif (logBootTrace)",
"\t\t\tMonitor.logThrowable(new Throwable(\"shutdown trace\"));",
"\t\t\t"
],
"header": "@@ -469,6 +473,10 @@ public class BaseDataFileFactory",
"removed": []
}
]
}
] |
derby-DERBY-4594-3dd23996
|
DERBY-4594: ArrayIndexOutOfBoundsException thrown in PreparedStatement execution
Added missing categorize() method in CoalesceFunctionNode.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@927430 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.util.JBitSet;",
""
],
"header": "@@ -30,13 +30,12 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": [
"import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;",
"",
"import org.apache.derby.iapi.sql.compile.Visitable;"
]
}
]
}
] |
derby-DERBY-4595-4ce669e5
|
DERBY-4679 Several left outer joins causes unstable query with incorrect results
Follow-up patch derby-4679-followup, which makes the original patch
safer by also matching the column name once a candidate result column
has been located using the table number and column number pair to
match an RC. This is to safe-guard against false matches, since
DERBY-4595 shows that the column number can be wrong in certain
situations.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@957260 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java",
"hunks": [
{
"added": [
" * <p/>",
" * {@code columnName} is used to assert that we find the right column.",
" * If we found a match on (tn, cn) but columnName is wrong, return null.",
" * Once we trust table numbers and column numbers to always be correct,",
" * cf. DERBY-4695, we can remove this parameter.",
" * @param columnName name of the desired column",
" public ResultColumn getResultColumn(int tableNumber,",
" int columnNumber,",
" String columnName)"
],
"header": "@@ -321,11 +321,19 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
" public ResultColumn getResultColumn(int tableNumber, int columnNumber)"
]
},
{
"added": [
" // Found matching (t,c) within this top",
" // resultColumn. Now do sanity check that column",
" // name is correct. Remove when DERBY-4695 is",
" // fixed.",
" if (columnName.equals(",
" vcn.getSourceColumn().getName())) {",
" resultColumn.setReferenced();",
" return resultColumn;",
" } else {",
" if (SanityManager.DEBUG) {",
" SanityManager.ASSERT(",
" false,",
" \"wrong (tn,cn) for column \" +",
" columnName +",
" \" found: this pair points to \" +",
" vcn.getSourceColumn().getName());",
" }",
" // Fall back on column name based lookup,",
" // cf. DERBY-4679. See ColumnReference#",
" // remapColumnReferencesToExpressions",
" return null;",
" }"
],
"header": "@@ -347,10 +355,28 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
" // Found matching (t,c) within this top resultColumn",
" resultColumn.setReferenced();",
" return resultColumn;",
""
]
}
]
}
] |
derby-DERBY-4597-7a7a289e
|
DERBY-4806 DERBY-4597 removes references to IBM jcc driver on Main.java, fixing extracting derbyTesting.jar information when it is not in the same directory as derbyrun.jar
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1002682 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java",
"hunks": [
{
"added": [
""
],
"header": "@@ -139,9 +139,9 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
""
]
},
{
"added": [
" private static final String USAGESTRINGPARTA = MAINUSAGESTRING + \" [ [ \"",
" + EMBEDDED + \" ][ \" + NET + \" ][ \" + CLIENT + \"] [ \" + TOOLS",
" + \" ] [\";"
],
"header": "@@ -512,13 +512,14 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
"\tprivate static final String DB2DRIVER = \"db2driver\";",
"\tprivate static final String USAGESTRINGPARTA = MAINUSAGESTRING + \" [ [ \" + EMBEDDED + \" ][ \" + NET + \" ][ \" + CLIENT + \"] [ \" + DB2DRIVER + \" ] [ \" + TOOLS + \" ] [ \";"
]
},
{
"added": [],
"header": "@@ -566,7 +567,6 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
"\t\t tryDB2DriverClasspath(successes, failures);"
]
},
{
"added": [],
"header": "@@ -602,10 +602,6 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
"\t\tif (argumentsContain(args,DB2DRIVER)) {",
"\t\t\ttryDB2DriverClasspath(successes, failures);",
"\t\t\tseenArg =true;",
"\t\t}"
]
},
{
"added": [],
"header": "@@ -650,13 +646,6 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
" private static void tryDB2DriverClasspath(StringBuffer successes,",
" StringBuffer failures)",
" {",
" tryMyClasspath(\"com.ibm.db2.jcc.DB2Driver\",",
" Main.getTextMessage(\"SIF08.L\", \"db2jcc.jar\"),",
" successes, failures);",
" }"
]
},
{
"added": [
" * Check inside a jar file for the presence of a Derby info properties file.",
" * ",
" * @param filename",
" * the jar file to check",
" * @return ZipInfoProperties with the jar file set as the location or null",
" * if not found."
],
"header": "@@ -1021,14 +1010,12 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
" * Check inside a jar file for the presence of a Derby info properties",
" * file. There is a special case for db2jcc, which does not have a Derby",
" * info propeties file. If db2jcc is in the filename, acquire DB2Driver",
" * via reflection and get the version number from it.",
" *",
" * @param filename the jar file to check",
" * @return ZipInfoProperties with the jar file set as the location",
" * or null if not found."
]
},
{
"added": [
"",
" try {",
" // DERBY-4806 Should use UTF-8 according to",
" // http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars",
" // to get the string of the file name",
" return URLDecoder.decode(result.toString(), \"UTF-8\");",
" } catch (UnsupportedEncodingException e) {",
" // All JVMs are required to support UTF-8.",
" return e.getMessage();",
" }"
],
"header": "@@ -1126,8 +1113,16 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
" ",
" return formatURL(result);"
]
},
{
"added": [
" result = e.getMessage();"
],
"header": "@@ -1228,7 +1223,7 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
" result = \"IOException\";"
]
}
]
}
] |
derby-DERBY-4597-8f4602dd
|
DERBY-4597 remove references to IBM jcc driver from sysinfo
Contributed by Lily Wei lilywei at yahoo dot com
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@955001 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java",
"hunks": [
{
"added": [],
"header": "@@ -1033,63 +1033,6 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
"",
"\t// Check to see if it's a version of db2jcc.jar and if so, report the version number. ",
"\tif (filename.indexOf(\"db2jcc\") >= 0)",
"\t{",
"\t Class c = null;",
"\t Method m = null;",
"\t Object o = null;",
"\t Integer build = null;",
"\t Integer major = null;",
" Integer minor = null;",
"\t try ",
"\t {",
" try ",
"\t\t{",
"\t\t c = Class.forName(\"com.ibm.db2.jcc.DB2Driver\");",
"\t\t m = c.getMethod(\"getJCCBuildNumber\", null);",
"\t\t o = c.newInstance();",
"\t\t build = (Integer)m.invoke(o,null);",
"\t\t} catch (ClassNotFoundException cnfe) {",
"\t\t c = Class.forName(\"com.ibm.db2.jcc.DB2Version\");",
"\t\t m = c.getMethod(\"getBuildNumber\", null);",
"\t\t o = c.newInstance();",
"\t\t build = (Integer)m.invoke(o,null);",
"\t } ",
"\t\tm = c.getMethod(\"getMajorVersion\", null);",
"\t\tmajor = (Integer)m.invoke(o,null);",
"\t\tm = c.getMethod(\"getMinorVersion\", null);",
"\t\tminor = (Integer)m.invoke(o,null);",
"",
"\t\tProductVersionHolder jccVersion = ProductVersionHolder.getProductVersionHolder(",
"\t\t\t\"IBM Corp.\",",
"\t\t\t\"DB2 Java Common Client\",",
"\t\t\t\"DRDA:jcc\",",
"\t\t\tmajor.intValue(),",
"\t\t\tminor.intValue(),",
"\t\t\t0,",
"\t\t\t0,",
"\t\t\tbuild.toString(),",
"\t\t\tBoolean.FALSE);",
"",
"\t\tZipInfoProperties zip = new ZipInfoProperties(jccVersion);",
"",
" String loc = getFileWhichLoadedClass(c);",
" // For db2jcc.jar, report the actual file from which DB2Driver",
" // was loaded, if we can determine it. For db2jcc_license_c,",
" // report the filename from the classpath, and the version ",
" // info from the DB2Driver that we loaded. This is slightly",
" // misleading, since db2jcc_license_c.jar doesn't really have",
" // a \"version\", but the two jars are usually linked.",
" if (loc != null && filename.indexOf(\"license_c\") < 0)",
" zip.setLocation(loc);",
" else",
" zip.setLocation(new File(filename).getCanonicalPath().replace('/', File.separatorChar));",
"\t\treturn zip;",
" } catch (Exception e) { return null; }",
"\t}",
""
]
}
]
}
] |
derby-DERBY-4598-b7e89514
|
DERBY-4598 Print class loader used to boot and shutdown derby in derby.log
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@928065 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java",
"hunks": [
{
"added": [
" dataDirectory + \" \" + readOnlyMsg,",
" // cast to Object so we get object hash code",
" (Object) this.getClass().getClassLoader()",
" ));"
],
"header": "@@ -359,8 +359,10 @@ public class BaseDataFileFactory",
"removed": [
" dataDirectory,",
" readOnlyMsg));"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/harness/Sed.java",
"hunks": [
{
"added": [
" //DERBY-4588 - filter out specific class and object id",
" searchStrings.addElement(\"with class loader .*,\");",
" "
],
"header": "@@ -116,6 +116,9 @@ public class Sed",
"removed": []
}
]
}
] |
derby-DERBY-4600-fc5f3cc7
|
DERBY-4600: Use ValueNodeList helper methods in CoalesceFunctionNode
Use the helper methods defined in ValueNodeList to process the
argumentsList field in CoalesceFunctionNode. Also add a new helper
method, isEquivalent(), and use it in BinaryListOperatorNode,
ConditionalNode and CoalesceFunctionNode.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@928649 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CoalesceFunctionNode.java",
"hunks": [
{
"added": [
"",
" if (!argumentsList.isEquivalent(other.argumentsList))",
""
],
"header": "@@ -360,22 +360,12 @@ public class CoalesceFunctionNode extends ValueNode",
"removed": [
"\t\tif (other.argumentsList.size() != argumentsList.size())",
"\t\t\t",
"\t\t}",
"\t\t",
"\t\tint size = argumentsList.size();",
"\t\tfor (int index = 0; index < size; index++)",
"\t\t{",
"\t\t\tValueNode v1 = (ValueNode)argumentsList.elementAt(index);",
"\t\t\tValueNode v2 = (ValueNode)other.argumentsList.elementAt(index);",
"\t\t\tif (!v1.isEquivalent(v2)) ",
"\t\t\t{",
"\t\t\t\treturn false;",
"\t\t\t}"
]
},
{
"added": [
" argumentsList = (ValueNodeList) argumentsList.accept(v);"
],
"header": "@@ -389,12 +379,7 @@ public class CoalesceFunctionNode extends ValueNode",
"removed": [
"\t\tint size = argumentsList.size();",
"\t\tfor (int index = 0; index < size; index++)",
"\t\t{",
"\t\t\targumentsList.setElementAt(",
"\t\t\t\t\t(QueryTreeNode)(argumentsList.elementAt(index)).accept(v), index);",
"\t\t}"
]
},
{
"added": [
" argumentsList.preprocess(",
" numTables,",
" outerFromList,",
" outerSubqueryList,",
" outerPredicateList);",
""
],
"header": "@@ -429,14 +414,12 @@ public class CoalesceFunctionNode extends ValueNode",
"removed": [
"\t\tint argumentsListSize = argumentsList.size();",
"\t\tfor (int i=0; i < argumentsListSize; i++) {",
"\t\t\t((ValueNode)argumentsList.elementAt(i)).preprocess",
"\t\t\t\t(numTables,",
"\t\t\t\t outerFromList,",
"\t\t\t\t outerSubqueryList,",
"\t\t\t\t outerPredicateList);",
"\t\t}"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ValueNodeList.java",
"hunks": [
{
"added": [
" /**",
" * Check if all the elements in this list are equivalent to the elements",
" * in another list. The two lists must have the same size, and the",
" * equivalent nodes must appear in the same order in both lists, for the",
" * two lists to be equivalent.",
" *",
" * @param other the other list",
" * @return {@code true} if the two lists contain equivalent elements, or",
" * {@code false} otherwise",
" * @throws StandardException thrown on error",
" * @see ValueNode#isEquivalent(ValueNode)",
" */",
" boolean isEquivalent(ValueNodeList other) throws StandardException {",
" if (size() != other.size()) {",
" return false;",
" }",
"",
" for (int i = 0; i < size(); i++) {",
" ValueNode vn1 = (ValueNode) elementAt(i);",
" ValueNode vn2 = (ValueNode) other.elementAt(i);",
" if (!vn1.isEquivalent(vn2)) {",
" return false;",
" }",
" }",
"",
" return true;",
" }",
""
],
"header": "@@ -583,6 +583,34 @@ public class ValueNodeList extends QueryTreeNodeVector",
"removed": []
}
]
}
] |
derby-DERBY-4602-1eee3053
|
DERBY-4602, DERBY-4483: Use SHA-1 for BUILTIN authentication if SHA-256 isn't supported
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@929715 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"import java.security.MessageDigest;",
"import java.security.NoSuchAlgorithmException;"
],
"header": "@@ -158,6 +158,8 @@ import java.util.LinkedList;",
"removed": []
},
{
"added": [
" findDefaultBuiltinAlgorithm(),"
],
"header": "@@ -765,7 +767,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" Property.AUTHENTICATION_BUILTIN_ALGORITHM_DEFAULT,"
]
}
]
}
] |
derby-DERBY-4604-427cb4e5
|
DERBY-4604: test lang.CollationTest.testSwedishCaseInsensitiveCollation fails with IBM's weme6.2/1.4.2. & Sun's 1.4.2
Disable test case when the JVM suffers from this bug:
http://bugs.sun.com/view_bug.do?bug_id=4804273
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@930177 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4607-f18f8b08
|
DERBY-4607: HeapScan test commits wrong connection
Use BaseJDBCTestCase helper methods to ensure that the same connection
is used all places in the HeapScan and in its sub-class
CoveredIdxScan. (Previously, different connections were used when
executing a statement and when committing.)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@931255 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/perf/basic/jdbc/CoveredIdxScan.java",
"hunks": [
{
"added": [
" select = prepareStatement(\"SELECT i1 FROM \" + tableName +"
],
"header": "@@ -63,7 +63,7 @@ public class CoveredIdxScan extends HeapScan {",
"removed": [
" select = openDefaultConnection().prepareStatement(\"SELECT i1 FROM \"+tableName +"
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/perf/basic/jdbc/HeapScan.java",
"hunks": [
{
"added": [
" select = prepareStatement(\"SELECT * FROM \" + tableName);"
],
"header": "@@ -103,7 +103,7 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": [
" select = openDefaultConnection().prepareStatement(\"SELECT * FROM \"+tableName);"
]
},
{
"added": [
" commit();"
],
"header": "@@ -147,7 +147,7 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": [
" getConnection().commit();"
]
},
{
"added": [
" commit();"
],
"header": "@@ -177,8 +177,8 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": [
" getConnection().commit();"
]
},
{
"added": [
" // The statements will be closed by BaseJDBCTestCase.tearDown(), but",
" // we need to set the fields to null to allow them to be garbage",
" // collected.",
" selectWithPred = null;"
],
"header": "@@ -197,10 +197,11 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": [
"",
" select.close();",
" selectWithPred = null; // will be closed in super.tearDown()"
]
}
]
}
] |
derby-DERBY-4608-876391e4
|
DERBY-4608: Unnecessary conversion of binary values to strings in SQLBinary.compare()
Use isNull() instead of getString() to check if the values are null,
since we don't need the string representation of the values. Also add
a test case to HeapScan to demonstrate the performance impact.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@931189 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/perf/basic/jdbc/BaseLoad100TestSetup.java",
"hunks": [
{
"added": [
"import java.io.IOException;"
],
"header": "@@ -20,6 +20,7 @@",
"removed": []
},
{
"added": [
" * One of the constructors allows the data type of the last four columns to be",
" * changed to CHAR(20) FOR BIT DATA.",
" *"
],
"header": "@@ -37,6 +38,9 @@ import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;",
"removed": []
},
{
"added": [
" private boolean binaryData;"
],
"header": "@@ -46,6 +50,7 @@ public class BaseLoad100TestSetup extends CleanDatabaseTestSetup {",
"removed": []
},
{
"added": [
" this(test, rowsToLoad, tableName, false);",
" }",
"",
" /**",
" * @param test name of test",
" * @param rowsToLoad number of rows to insert",
" * @param tableName name of the table to insert the rows into",
" * @param binaryData whether or not c6, ..., c9 should contain binary data",
" */",
" public BaseLoad100TestSetup(",
" Test test, int rowsToLoad, String tableName, boolean binaryData) {",
" this.binaryData = binaryData;"
],
"header": "@@ -82,9 +87,21 @@ public class BaseLoad100TestSetup extends CleanDatabaseTestSetup {",
"removed": []
},
{
"added": [
" StringBuffer ddl = new StringBuffer();",
" ddl.append(\"CREATE TABLE \").append(tableName);",
" ddl.append(\"(i1 INT, i2 INT, i3 INT, i4 INT, i5 INT\");",
" for (int i = 6; i <= 9; i++) {",
" ddl.append(\", c\").append(i).append(\" CHAR(20)\");",
" if (binaryData) {",
" ddl.append(\" FOR BIT DATA\");",
" }",
" }",
" ddl.append(')');",
" s.execute(ddl.toString());"
],
"header": "@@ -112,10 +129,17 @@ public class BaseLoad100TestSetup extends CleanDatabaseTestSetup {",
"removed": [
" s.execute(\"CREATE TABLE \" +tableName+\" (\"",
" + \"i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, \"",
" + \"c6 CHAR(20), c7 CHAR(20), c8 CHAR(20), c9 CHAR(20))\");",
""
]
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/perf/basic/jdbc/HeapScan.java",
"hunks": [
{
"added": [
" private PreparedStatement selectWithPred;",
" private boolean binaryData;",
" TestSuite suite = new TestSuite(\"HeapScanTests\");",
" suite.addTest(baseSuite(\"HeapScan:CHAR\", false));",
" suite.addTest(baseSuite(\"HeapScan:BINARY\", true));",
" return suite;",
" }",
"",
" /**",
" * Create a suite of all the tests in this class with the appropriate",
" * decorator.",
" *",
" * @param name the name of the returned test suite",
" * @param binaryData whether or not these tests should use binary data",
" * instead of character data",
" * @return a test suite",
" */",
" private static Test baseSuite(String name, boolean binaryData) {",
" TestSuite heapScan = new TestSuite(name);",
" heapScan.addTest(new HeapScan(\"Scan100\", binaryData,",
" iterations, repeats));",
" heapScan.addTest(new HeapScan(\"Scan100GetData\", binaryData,",
" iterations, repeats));",
" heapScan.addTest(new HeapScan(\"Scan100WithPredicate\", binaryData,",
" iterations, repeats));",
" return new BaseLoad100TestSetup(",
" heapScan, rowcount, tableName, binaryData);"
],
"header": "@@ -33,20 +33,43 @@ import org.apache.derbyTesting.junit.JDBCPerfTestCase;",
"removed": [
" TestSuite heapScan = new TestSuite(\"HeapScanTests\");",
" heapScan.addTest(new HeapScan(\"Scan100\",iterations,repeats));",
" heapScan.addTest(new HeapScan(\"Scan100GetData\",iterations,repeats));",
" return new BaseLoad100TestSetup(heapScan,rowcount,tableName);"
]
},
{
"added": [
" {",
" this(name, false, iterations, repeats);",
" }",
"",
" /**",
" * Scan tests.",
" * @param name test name",
" * @param binaryData whether or not binary data should be used instead",
" * of character data",
" * @param iterations iterations of the test to measure",
" * @param repeats number of times to repeat the test",
" */",
" public HeapScan(String name, boolean binaryData,",
" int iterations, int repeats)",
" this.binaryData = binaryData;"
],
"header": "@@ -56,8 +79,23 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": []
},
{
"added": [
"",
" // Create a SELECT statement that uses predicates. Also initialize",
" // the predicates with some data of the correct type for this test",
" // (either character data or binary data).",
" selectWithPred = prepareStatement(",
" \"SELECT * FROM \" + tableName + \" WHERE \" +",
" \"c6=? OR c7=? OR c8=? OR c9=?\");",
" Object predicate = \"abcdef\";",
" if (binaryData) {",
" predicate = ((String) predicate).getBytes(\"US-ASCII\");",
" }",
" for (int i = 1; i <= 4; i++) {",
" selectWithPred.setObject(i, predicate);",
" }"
],
"header": "@@ -66,6 +104,20 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": []
},
{
"added": [
" Object c6 = rs.getObject(6);",
" Object c7 = rs.getObject(7);",
" Object c8 = rs.getObject(8);",
" Object c9 = rs.getObject(9);"
],
"header": "@@ -117,10 +169,10 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": [
" String c6 = rs.getString(6);",
" String c7 = rs.getString(7);",
" String c8 = rs.getString(8);",
" String c9 = rs.getString(9);"
]
},
{
"added": [
" /**",
" * Test the performance of a table scan that needs to compare all the",
" * char values in the table with some specified values. Used to test the",
" * performance gains in DERBY-4608.",
" */",
" public void Scan100WithPredicate() throws SQLException {",
" ResultSet rs = selectWithPred.executeQuery();",
" assertFalse(\"should be empty\", rs.next());",
" rs.close();",
" commit();",
" }",
""
],
"header": "@@ -129,6 +181,18 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": []
},
{
"added": [
" selectWithPred = null; // will be closed in super.tearDown()"
],
"header": "@@ -136,6 +200,7 @@ public class HeapScan extends JDBCPerfTestCase {",
"removed": []
}
]
}
] |
derby-DERBY-4610-b2d4ac8d
|
DERBY-4610: Error attempting delete with cascade and triggers
Added a regression test case for the bug. Not enabled yet.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@938959 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4610-c69c8b01
|
DERBY-4610: Error attempting delete with cascade and triggers
Backed out the fix for DERBY-3049 (four commits) using this command:
svn merge -c -601395,-600678,-598739,-572753 .
Additionally, two import statements that had been removed in later
commits had to be reintroduced manually in
BasicNoPutResultSetImpl.java and TemporaryRowHolderImpl.java.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@940462 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.monitor.Monitor;",
"import org.apache.derby.iapi.error.StandardException;",
"",
"import org.apache.derby.iapi.sql.dictionary.*;",
"",
"import org.apache.derby.iapi.types.TypeId;",
"import org.apache.derby.iapi.sql.depend.Dependent;",
"import org.apache.derby.iapi.sql.depend.Provider;",
"import org.apache.derby.iapi.reference.SQLState;",
"import org.apache.derby.iapi.sql.execute.ConstantAction;",
"import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;",
"import org.apache.derby.iapi.services.uuid.UUIDFactory;",
"import org.apache.derby.iapi.services.io.FormatableBitSet;",
"import org.apache.derby.catalog.AliasInfo;",
"import org.apache.derby.catalog.DefaultInfo;",
"import org.apache.derby.catalog.Dependable;",
"import org.apache.derby.catalog.DependableFinder;",
"import org.apache.derby.catalog.UUID;",
"import org.apache.derby.catalog.Statistics;",
"import java.sql.Timestamp;",
"import java.io.InputStream;"
],
"header": "@@ -21,14 +21,30 @@",
"removed": [
"import java.sql.Timestamp;",
"import org.apache.derby.catalog.UUID;",
"import org.apache.derby.iapi.error.StandardException;",
"import org.apache.derby.iapi.services.io.FormatableBitSet;",
"import org.apache.derby.iapi.services.uuid.UUIDFactory;"
]
},
{
"added": [],
"header": "@@ -53,7 +69,6 @@ public class DataDescriptorGenerator",
"removed": [
" uuidf = dataDictionary.getUUIDFactory();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java",
"hunks": [
{
"added": [
"\t\tresultDescription = theResults.getResultDescription();"
],
"header": "@@ -256,7 +256,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
"\t\tresultDescription = theResults.getActivation().getResultDescription();"
]
},
{
"added": [
" ResultDescription rd = theResults.getResultDescription();",
" if (columnIndex < 1 || columnIndex > rd.getColumnCount())",
"\t\t\t\t\tnew Integer(columnIndex), String.valueOf(rd.getColumnCount()));",
" if (rd.getColumnDescriptor(columnIndex).getSourceTableName() == null)",
"\t\t\t\t\ttheResults.getResultDescription().getColumnDescriptor(columnIndex).getName(),"
],
"header": "@@ -2220,19 +2220,20 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
" if (columnIndex < 1 || columnIndex > resultDescription.getColumnCount())",
"\t\t\t\t\tnew Integer(columnIndex), String.valueOf(resultDescription.getColumnCount()));",
" if (resultDescription.getColumnDescriptor(columnIndex).getSourceTableName() == null)",
"\t\t\t\t\tresultDescription.getColumnDescriptor(columnIndex).getName(),"
]
},
{
"added": [
" ResultDescription rd = theResults.getResultDescription();",
" for (int i=1; i<=rd.getColumnCount(); i++) { "
],
"header": "@@ -3585,11 +3586,12 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
" for (int i=1; i<=resultDescription.getColumnCount(); i++) { "
]
},
{
"added": [
" rd.getColumnDescriptor(i).getName()));"
],
"header": "@@ -3597,7 +3599,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
" resultDescription.getColumnDescriptor(i).getName()));"
]
},
{
"added": [
" for (int i=1, paramPosition=0; i<=rd.getColumnCount(); i++) { "
],
"header": "@@ -3625,7 +3627,7 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
" for (int i=1, paramPosition=0; i<=resultDescription.getColumnCount(); i++) { "
]
},
{
"added": [
" ResultDescription rd = theResults.getResultDescription();",
"",
" for (int i=1; i<=rd.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql",
" rd.getColumnDescriptor(i).getName()) + \"=?\");"
],
"header": "@@ -3682,14 +3684,15 @@ public abstract class EmbedResultSet extends ConnectionChild",
"removed": [
" ",
" for (int i=1; i<=resultDescription.getColumnCount(); i++) { //in this for loop we are constructing columnname=?,... part of the update sql",
" resultDescription.getColumnDescriptor(i).getName()) + \"=?\");"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/GenericResultDescription.java",
"hunks": [
{
"added": [
" private Map columnNameMap;"
],
"header": "@@ -79,7 +79,7 @@ public final class GenericResultDescription",
"removed": [
" private transient Map columnNameMap;"
]
},
{
"added": [
"\t/**",
"\t * Build a GenericResultDescription ",
"\t *",
"\t * @param rd the result description",
"\t * @param theCols the columns to take from the input rd",
"\t */",
"\tpublic GenericResultDescription",
"\t(",
"\t\tResultDescription\trd, ",
"\t\tint[]\t\t\t\ttheCols",
"\t) ",
"\t{",
"\t\tif (SanityManager.DEBUG)",
"\t\t{",
"\t\t\tSanityManager.ASSERT(theCols != null, \"theCols argument to GenericResultDescription is null\");",
"\t\t}",
"",
"\t\tthis.columns = new ResultColumnDescriptor[theCols.length];",
"\t\tfor (int i = 0; i < theCols.length; i++)",
"\t\t{",
"\t\t\tcolumns[i] = rd.getColumnDescriptor(theCols[i]);",
"\t\t}",
"\t\tthis.statementType = rd.getStatementType();",
"\t}",
""
],
"header": "@@ -101,6 +101,31 @@ public final class GenericResultDescription",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.ResultDescription;"
],
"header": "@@ -30,6 +30,7 @@ import org.apache.derby.iapi.services.i18n.MessageService;",
"removed": []
},
{
"added": [
"\tResultDescription resultDescription;",
""
],
"header": "@@ -87,6 +88,8 @@ implements NoPutResultSet",
"removed": []
},
{
"added": [
"\t * @param resultDescription the result description. May be null."
],
"header": "@@ -96,6 +99,7 @@ implements NoPutResultSet",
"removed": []
},
{
"added": [
"\tBasicNoPutResultSetImpl(ResultDescription resultDescription,",
"\t\t\t\t\t\t\tActivation activation,",
"\t\tthis.resultDescription = resultDescription;"
],
"header": "@@ -103,13 +107,15 @@ implements NoPutResultSet",
"removed": [
"\tBasicNoPutResultSetImpl(Activation activation,"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DMLVTIResultSet.java",
"hunks": [
{
"added": [
" ResultDescription \t\tresultDescription;",
"\t/**",
" * Returns the description of the inserted rows.",
" * REVISIT: Do we want this to return NULL instead?",
"\t */",
"\tpublic ResultDescription getResultDescription()",
"\t{",
"\t return resultDescription;",
"\t}",
""
],
"header": "@@ -51,9 +51,19 @@ abstract class DMLVTIResultSet extends DMLWriteResultSet",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DeleteCascadeResultSet.java",
"hunks": [
{
"added": [
"public class DeleteCascadeResultSet extends DeleteResultSet",
"\tprivate CursorResultSet parentSource;",
"\tprivate FKInfo parentFKInfo;",
"\tprivate long fkIndexConglomNumber;"
],
"header": "@@ -53,12 +53,15 @@ import java.util.Enumeration;",
"removed": [
"class DeleteCascadeResultSet extends DeleteResultSet"
]
},
{
"added": [
" public DeleteCascadeResultSet"
],
"header": "@@ -68,7 +71,7 @@ class DeleteCascadeResultSet extends DeleteResultSet",
"removed": [
" DeleteCascadeResultSet"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java",
"hunks": [
{
"added": [
"\t/**",
" * Returns the description of the deleted rows.",
" * REVISIT: Do we want this to return NULL instead?",
"\t */",
"\tpublic ResultDescription getResultDescription()",
"\t{",
"\t return resultDescription;",
"\t}",
""
],
"header": "@@ -81,6 +81,15 @@ class DeleteResultSet extends DMLWriteResultSet",
"removed": []
},
{
"added": [
"\t\t\tresultDescription = source.getResultDescription();"
],
"header": "@@ -121,7 +130,7 @@ class DeleteResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\tresultDescription = activation.getResultDescription();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericTriggerExecutor.java",
"hunks": [
{
"added": [
"public abstract class GenericTriggerExecutor",
"\tprotected InternalTriggerExecutionContext\ttec;",
"\tprotected TriggerDescriptor\t\t\t\t\ttriggerd;",
"\tprotected Activation\t\t\t\t\t\tactivation;",
"\tprotected LanguageConnectionContext\t\t\tlcc;",
"\tprivate\tboolean\t\t\twhenClauseRetrieved;",
"\tprivate\tboolean\t\t\tactionRetrieved;",
"\tprivate SPSDescriptor\twhenClause; ",
"\tprivate SPSDescriptor\taction;"
],
"header": "@@ -38,13 +38,17 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": [
"abstract class GenericTriggerExecutor",
"\tfinal InternalTriggerExecutionContext\ttec;",
"\tfinal TriggerDescriptor\t\t\t\t\ttriggerd;",
"\tfinal Activation\t\t\t\t\t\tactivation;",
"\tfinal LanguageConnectionContext\t\t\tlcc;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java",
"hunks": [
{
"added": [
" private\tResultDescription \t\tresultDescription;"
],
"header": "@@ -98,6 +98,7 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": []
},
{
"added": [
"\t/**",
" * Returns the description of the inserted rows.",
" * REVISIT: Do we want this to return NULL instead?",
"\t */",
"\tpublic ResultDescription getResultDescription()",
"\t{",
"\t return resultDescription;",
"\t}",
""
],
"header": "@@ -167,6 +168,15 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": []
},
{
"added": [
" resultDescription = sourceResultSet.getResultDescription();"
],
"header": "@@ -334,7 +344,7 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": [
" ResultDescription resultDescription = activation.getResultDescription();"
]
},
{
"added": [
"\t\t\trowHolder = new TemporaryRowHolderImpl(activation, properties,",
"\t\t\t\t\t\t\t\t\t\t\t\t resultDescription);",
"\t\t\tResultDescription rd;"
],
"header": "@@ -944,13 +954,15 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": [
"\t\t\trowHolder = new TemporaryRowHolderImpl(activation, properties);"
]
},
{
"added": [
"\t\t\trd = lcc.getLanguageFactory().getResultDescription(resultDescription,columnIndexes);",
"\t\t\t\tnew TemporaryRowHolderImpl(activation, properties, rd);"
],
"header": "@@ -963,8 +975,9 @@ class InsertResultSet extends DMLWriteResultSet implements TargetResultSet",
"removed": [
"\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/NoPutResultSetImpl.java",
"hunks": [
{
"added": [
"\t\tsuper(null,",
"\t\t\t\tactivation,"
],
"header": "@@ -93,7 +93,8 @@ extends BasicNoPutResultSetImpl",
"removed": [
"\t\tsuper(activation,"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.ResultDescription;"
],
"header": "@@ -27,6 +27,7 @@ import org.apache.derby.iapi.sql.execute.CursorResultSet;",
"removed": []
},
{
"added": [
"\tprivate\tResultDescription\t\tresultDescription;"
],
"header": "@@ -68,7 +69,7 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder",
"removed": [
""
]
},
{
"added": [
"\t * @param resultDescription the result description. Relevant for the getResultDescription",
"\t * \t\tcall on the result set returned by getResultSet. May be null",
"\tpublic TemporaryRowHolderImpl",
"\t\tProperties \t\t\t\tproperties, ",
"\t\tResultDescription\t\tresultDescription",
"\t\tthis(activation, properties, resultDescription,"
],
"header": "@@ -99,14 +100,17 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder",
"removed": [
"\tTemporaryRowHolderImpl",
"\t\tProperties \t\t\t\tproperties",
"\t\tthis(activation, properties,"
]
},
{
"added": [
"\t * @param resultDescription the result description. Relevant for the getResultDescription",
"\t * \t\tcall on the result set returned by getResultSet. May be null",
"\tpublic TemporaryRowHolderImpl",
"\t\tResultDescription\t\tresultDescription,",
"\t\tthis(activation, properties, resultDescription, 1, isUniqueStream,"
],
"header": "@@ -117,16 +121,19 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder",
"removed": [
"\tTemporaryRowHolderImpl",
"\t\tthis(activation, properties, 1, isUniqueStream,"
]
},
{
"added": [
"\t * @param resultDescription the result description. Relevant for the getResultDescription",
"\t * \t\tcall on the result set returned by getResultSet. May be null",
"\tpublic TemporaryRowHolderImpl",
"\t\tResultDescription\t\tresultDescription,"
],
"header": "@@ -137,14 +144,17 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder",
"removed": [
"\tTemporaryRowHolderImpl"
]
},
{
"added": [
"\t\tthis.resultDescription = resultDescription;"
],
"header": "@@ -163,6 +173,7 @@ class TemporaryRowHolderImpl implements TemporaryRowHolder",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java",
"hunks": [
{
"added": [
"\tprivate ResultDescription\t\tresultDescription;"
],
"header": "@@ -58,6 +58,7 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl",
"removed": []
},
{
"added": [
"\t * @param resultDescription value returned by getResultDescription()",
"\tpublic TemporaryRowHolderResultSet",
"\t\tResultDescription\t\t\tresultDescription,",
"\t\tthis(tc, rowArray, resultDescription, isVirtualMemHeap, false, 0, holder);"
],
"header": "@@ -73,17 +74,19 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl",
"removed": [
"\tTemporaryRowHolderResultSet",
"\t\tthis(tc, rowArray, isVirtualMemHeap, false, 0, holder);"
]
},
{
"added": [
"\t * @param resultDescription value returned by getResultDescription()",
"\tpublic TemporaryRowHolderResultSet",
"\t\tResultDescription\t\t\tresultDescription,"
],
"header": "@@ -93,14 +96,16 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl",
"removed": [
"\tTemporaryRowHolderResultSet"
]
},
{
"added": [
"\t\tthis.resultDescription = resultDescription;"
],
"header": "@@ -109,6 +114,7 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl",
"removed": []
},
{
"added": [
"\tpublic static TemporaryRowHolderResultSet getNewRSOnCurrentRow",
"\t\t\tnew TemporaryRowHolderImpl(activation, null,",
"\t\t\t\t\t\t\t\t\t rs.getResultDescription());"
],
"header": "@@ -178,14 +184,15 @@ class TemporaryRowHolderResultSet implements CursorResultSet, NoPutResultSet, Cl",
"removed": [
"\tstatic TemporaryRowHolderResultSet getNewRSOnCurrentRow",
"\t\t\tnew TemporaryRowHolderImpl(activation, null);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/TriggerEventActivator.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.error.StandardException;",
"",
"import org.apache.derby.iapi.sql.execute.ExecRow; ",
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;",
"",
"import org.apache.derby.iapi.sql.Activation;",
"",
"import org.apache.derby.impl.sql.execute.AutoincrementCounter;",
"import org.apache.derby.iapi.reference.SQLState;",
"import org.apache.derby.iapi.jdbc.ConnectionContext;",
"import org.apache.derby.catalog.UUID;",
"",
"import java.util.Vector;",
"import java.sql.SQLException;",
"public class TriggerEventActivator",
"\tprivate TransactionController \t\t\ttc; "
],
"header": "@@ -21,26 +21,34 @@",
"removed": [
"import java.util.Vector;",
"",
"import org.apache.derby.catalog.UUID;",
"import org.apache.derby.iapi.error.StandardException;",
"import org.apache.derby.iapi.jdbc.ConnectionContext;",
"import org.apache.derby.iapi.sql.Activation;",
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;",
"class TriggerEventActivator"
]
},
{
"added": [
"\tpublic TriggerEventActivator"
],
"header": "@@ -64,7 +72,7 @@ class TriggerEventActivator",
"removed": [
"\tTriggerEventActivator"
]
},
{
"added": [
"\t\tthis.tc = tc;"
],
"header": "@@ -84,6 +92,7 @@ class TriggerEventActivator",
"removed": []
},
{
"added": [
"\tpublic void notifyEvent"
],
"header": "@@ -218,7 +227,7 @@ class TriggerEventActivator",
"removed": [
"\tvoid notifyEvent"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;"
],
"header": "@@ -34,6 +34,7 @@ import org.apache.derby.iapi.services.sanity.SanityManager;",
"removed": []
},
{
"added": [
" private ResultDescription \t\tresultDescription;"
],
"header": "@@ -61,6 +62,7 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": []
},
{
"added": [
"\tprivate ResultDescription\t\ttriggerResultDescription;",
"\t/**",
" * Returns the description of the updated rows.",
" * REVISIT: Do we want this to return NULL instead?",
"\t */",
"\tpublic ResultDescription getResultDescription()",
"\t{",
"\t return resultDescription;",
"\t}"
],
"header": "@@ -92,11 +94,20 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": []
},
{
"added": [
"\t\t\tresultDescription = source.getResultDescription();"
],
"header": "@@ -180,9 +191,8 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
" ResultDescription resultDescription;",
"\t\t\tresultDescription = activation.getResultDescription();"
]
},
{
"added": [
"\t\t\t\ttriggerResultDescription = (resultDescription != null) ?",
"\t\t\t\t\t\t\t\t\tresultDescription.truncateColumns(numberOfBaseColumns+1) :",
"\t\t\t\t\t\t\t\t\tnull;"
],
"header": "@@ -370,6 +380,9 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": []
},
{
"added": [
"\t\t\t\t\tnew TemporaryRowHolderImpl(activation, properties,",
"\t\t\t\t\t\t\t\t\t\t\t triggerResultDescription);",
"\t\t\t\tnew TemporaryRowHolderImpl(activation, properties,",
"\t\t\t\t\t\t\t\t\t\t triggerResultDescription);"
],
"header": "@@ -378,10 +391,12 @@ class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\t\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);",
"\t\t\t\tnew TemporaryRowHolderImpl(activation, properties);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/WriteCursorConstantAction.java",
"hunks": [
{
"added": [
"\t** \twritten persistently in stored prepared statements, ",
"\t**\tnot in the replication stage. SO, IT IS OK TO CHANGE",
"\t**\tITS read/writeExternal."
],
"header": "@@ -63,14 +63,12 @@ abstract\tclass WriteCursorConstantAction implements ConstantAction, Formatable",
"removed": [
"\t** \twritten persistently in stored prepared statements.",
" * SO, IT IS OK TO CHANGE ITS read/writeExternal.",
" /**",
" * Heap conglomerate identifier.",
" */"
]
}
]
}
] |
derby-DERBY-4613-eff39195
|
DERBY-4613: Make the client driver treat boolean columns the same way that the embedded driver does.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@943465 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ColumnMetaData.java",
"hunks": [
{
"added": [
" case Types.BOOLEAN:",
" return 5;"
],
"header": "@@ -286,6 +286,8 @@ public class ColumnMetaData implements java.sql.ResultSetMetaData {",
"removed": []
},
{
"added": [
" case Types.BOOLEAN:",
" return 1;"
],
"header": "@@ -419,6 +421,8 @@ public class ColumnMetaData implements java.sql.ResultSetMetaData {",
"removed": []
},
{
"added": [
" case DRDAConstants.DB2_SQLTYPE_BOOLEAN:",
" case DRDAConstants.DB2_SQLTYPE_NBOOLEAN:",
" return \"BOOLEAN\";"
],
"header": "@@ -550,6 +554,9 @@ public class ColumnMetaData implements java.sql.ResultSetMetaData {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return \"java.lang.Boolean\";"
],
"header": "@@ -684,6 +691,8 @@ public class ColumnMetaData implements java.sql.ResultSetMetaData {",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/client/am/Cursor.java",
"hunks": [
{
"added": [
" // Build a Java boolean from a 1-byte signed binary representation.",
" private final boolean get_BOOLEAN(int column) {",
" if ( org.apache.derby.client.am.SignedBinary.getByte",
" ( dataBuffer_, columnDataPosition_[column - 1] ) == 0 )",
" { return false; }",
" else { return true; }",
" }",
""
],
"header": "@@ -363,6 +363,14 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return get_BOOLEAN(column);"
],
"header": "@@ -763,6 +771,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return agent_.crossConverters_.getByteFromBoolean(get_BOOLEAN(column));"
],
"header": "@@ -790,6 +800,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return agent_.crossConverters_.getShortFromBoolean(get_BOOLEAN(column));"
],
"header": "@@ -816,6 +828,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return agent_.crossConverters_.getIntFromBoolean(get_BOOLEAN(column));"
],
"header": "@@ -842,6 +856,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return agent_.crossConverters_.getLongFromBoolean(get_BOOLEAN(column));"
],
"header": "@@ -868,6 +884,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return agent_.crossConverters_.getFloatFromBoolean(get_BOOLEAN(column));"
],
"header": "@@ -894,6 +912,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return agent_.crossConverters_.getDoubleFromBoolean(get_BOOLEAN(column));"
],
"header": "@@ -920,6 +940,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" return new java.math.BigDecimal( getInt( column ) );"
],
"header": "@@ -948,6 +970,8 @@ public abstract class Cursor {",
"removed": []
},
{
"added": [
" case java.sql.Types.BOOLEAN:",
" if ( get_BOOLEAN( column ) ) { return Boolean.TRUE.toString(); }",
" else { return Boolean.FALSE.toString(); }"
],
"header": "@@ -1039,6 +1063,9 @@ public abstract class Cursor {",
"removed": []
}
]
},
{
"file": "java/client/org/apache/derby/client/am/DatabaseMetaData.java",
"hunks": [
{
"added": [
" /** True if the server supports QRYCLSIMP. */",
" private boolean supportsQryclsimp_;",
" ",
" private boolean supportsLayerBStreaming_;",
"",
" /**",
" * True if the server supports session data caching",
" */",
" private boolean supportsSessionDataCaching_;",
"",
" /** True if the server supports UDTs */",
" private boolean supportsUDTs_;",
"",
" /**",
" * True if the server supports aborting a statement whilst transferring",
" * EXTDTA objects. Note that there are two types of aborts, depending on",
" * whether an object is being transferred to the server using DDM layer B",
" * streaming or not.",
" */",
" private boolean supportsEXTDTAAbort_;",
" ",
" /** True if the server supports nanoseconds in timestamps */",
" private boolean supportsTimestampNanoseconds_;",
" ",
" /** True if the server supports boolean values */",
" private boolean supportsBooleanValues_;",
""
],
"header": "@@ -69,6 +69,33 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {",
"removed": []
},
{
"added": [
" //-----------------------------helper methods---------------------------------",
"",
" // Set flags describing the level of support for this connection.",
" // Flags will be set based on manager level and/or specific product identifiers.",
" // Support for a specific server version can be set as follows. For example",
" // if (productLevel_.greaterThanOrEqualTo(11,1,0))",
" // supportsTheBestThingEver = true",
" //",
" // WARNING WARNING WARNING !!!!",
" //",
" // If you define an instance variable of NetDatabaseMetaData that",
" // you want computeFeatureSet_() to compute, DO NOT assign an",
" // initial value to the variable in the",
" // declaration. NetDatabaseMetaData's constructor will invoke",
" // DatabaseMetaData's constructor, which then invokes",
" // computeFeatureSet_(). Initialization of instance variables in",
" // NetDatabaseMetaData will happen *after* the invocation of",
" // computeFeatureSet_() and will therefore overwrite the computed",
" // values. So, LEAVE INSTANCE VARIABLES UNINITIALIZED!",
" //",
" // END OF WARNING",
" protected void computeFeatureSet_() {",
"",
" // Support for QRYCLSIMP was added in 10.2.0",
" if (productLevel_.greaterThanOrEqualTo(10, 2, 0)) {",
" supportsQryclsimp_ = true;",
" } else {",
" supportsQryclsimp_ = false;",
" }",
" ",
" supportsLayerBStreaming_ = ",
" productLevel_.greaterThanOrEqualTo(10, 3, 0);",
"",
" supportsSessionDataCaching_ =",
" productLevel_.greaterThanOrEqualTo(10, 4, 0);",
"",
" supportsUDTs_ =",
" productLevel_.greaterThanOrEqualTo(10, 6, 0);",
"",
" supportsTimestampNanoseconds_ =",
" productLevel_.greaterThanOrEqualTo(10, 6, 0);",
"",
" supportsEXTDTAAbort_ =",
" productLevel_.greaterThanOrEqualTo(10, 6, 0);",
"",
" supportsBooleanValues_ =",
" productLevel_.greaterThanOrEqualTo(10, 7, 0);",
" }",
"",
" /**",
" * Check whether the server has full support for the QRYCLSIMP",
" * parameter in OPNQRY.",
" *",
" * @return true if QRYCLSIMP is fully supported",
" */",
" final public boolean serverSupportsQryclsimp() {",
" return supportsQryclsimp_;",
" }",
"",
" final public boolean serverSupportsLayerBStreaming() {",
" return supportsLayerBStreaming_;",
" }",
"",
" /**",
" * Check if server supports session data caching",
" * @return true if the server supports this",
" */",
" final public boolean serverSupportsSessionDataCaching() {",
" return supportsSessionDataCaching_;",
" }",
" /**",
" * Check if server supports UDTs",
" * @return true if the server supports this",
" */",
" final public boolean serverSupportsUDTs() {",
" return supportsUDTs_;",
" }",
"",
" /**",
" * Check if server supports nanoseconds in timestamps",
" * @return true if the server supports this",
" */",
" final public boolean serverSupportsTimestampNanoseconds() {",
" return supportsTimestampNanoseconds_;",
" }",
"",
" /**",
" * Check if server supports product specific EXTDTA abort protocol.",
" * @return {@code true} if the server supports this.",
" */",
" final public boolean serverSupportsEXTDTAAbort() {",
" return supportsEXTDTAAbort_;",
" }",
"",
" /**",
" * Check if server supports boolean values",
" * @return true if the server supports this",
" */",
" final public boolean serverSupportsBooleanValues() {",
" return supportsUDTs_;",
" }"
],
"header": "@@ -2258,10 +2285,108 @@ public abstract class DatabaseMetaData implements java.sql.DatabaseMetaData {",
"removed": [
" //--------------------Abstract material layer call-down methods-----------------",
" // Compute feature set based on release",
" abstract protected void computeFeatureSet_();"
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/NetDatabaseMetaData.java",
"hunks": [
{
"added": [],
"header": "@@ -26,30 +26,6 @@ import org.apache.derby.client.am.SqlException;",
"removed": [
" /** True if the server supports QRYCLSIMP. */",
" private boolean supportsQryclsimp_;",
" ",
" private boolean supportsLayerBStreaming_;",
"",
" /**",
" * True if the server supports session data caching",
" */",
" private boolean supportsSessionDataCaching_;",
"",
" /** True if the server supports UDTs */",
" private boolean supportsUDTs_;",
"",
" /**",
" * True if the server supports aborting a statement whilst transferring",
" * EXTDTA objects. Note that there are two types of aborts, depending on",
" * whether an object is being transferred to the server using DDM layer B",
" * streaming or not.",
" */",
" private boolean supportsEXTDTAAbort_;",
" ",
" /** True if the server supports nanoseconds in timestamps */",
" private boolean supportsTimestampNanoseconds_;",
" "
]
}
]
},
{
"file": "java/client/org/apache/derby/client/net/Typdef.java",
"hunks": [
{
"added": [
" /* 0xBE Boolean */",
" new FdocaSimpleDataArray(0xBE, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 1, FIXEDLENGTH),",
" /* 0xBF null Boolean */",
" new FdocaSimpleDataArray(0xBF, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 1, FIXEDLENGTH),"
],
"header": "@@ -645,10 +645,10 @@ public class Typdef implements java.lang.Cloneable {",
"removed": [
" /* 0xBE Empties */",
" null,",
" /* 0xBF Empties */",
" null,"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/reference/DRDAConstants.java",
"hunks": [
{
"added": [
"\tpublic\tstatic final int DRDA_TYPE_BOOLEAN = 0xBE;",
"\tpublic\tstatic final int DRDA_TYPE_NBOOLEAN = 0xBF;"
],
"header": "@@ -144,12 +144,8 @@ public\tinterface\tDRDAConstants",
"removed": [
"\t// Experimental types. These codes will change when the Open Group",
"\t// publishes an addendum to the DRDA spec covering these",
"\t// datatypes.",
"\t",
"\t// public\tstatic final int DRDA_TYPE_BOOLEAN = 0xBE;",
"\t// public\tstatic final int DRDA_TYPE_NBOOLEAN = 0xBF;"
]
}
]
}
] |
derby-DERBY-4614-1e90bf4d
|
DERBY-4614: Checkin a warmed-up version of Nirmal's patch, which corrects the JDBC metadata for timestamps.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1042675 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/client/org/apache/derby/client/am/ColumnMetaData.java",
"hunks": [
{
"added": [
" return 29;"
],
"header": "@@ -318,7 +318,7 @@ public class ColumnMetaData implements java.sql.ResultSetMetaData {",
"removed": [
" return 26;"
]
},
{
"added": [
" return 29;"
],
"header": "@@ -452,7 +452,7 @@ public class ColumnMetaData implements java.sql.ResultSetMetaData {",
"removed": [
" return 26;"
]
}
]
}
] |
derby-DERBY-4615-866573f3
|
DERBY-4615: EmbedCallableStatement ignores Calendar in getDate, getTime and getTimestamp
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@934474 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java",
"hunks": [
{
"added": [
" public Date getDate(int parameterIndex, Calendar cal) throws SQLException",
" Date v = getParms().",
" getParameterForGet(parameterIndex-1).getDate(cal);"
],
"header": "@@ -405,11 +405,12 @@ public abstract class EmbedCallableStatement extends EmbedPreparedStatement",
"removed": [
" public Date getDate(int parameterIndex) throws SQLException",
"\t\t\tDate v = getParms().getParameterForGet(parameterIndex-1).getDate(getCal());"
]
},
{
"added": [
" public Time getTime(int parameterIndex, Calendar cal) throws SQLException",
" Time v = getParms().",
" getParameterForGet(parameterIndex-1).getTime(cal);"
],
"header": "@@ -423,11 +424,12 @@ public abstract class EmbedCallableStatement extends EmbedPreparedStatement",
"removed": [
"\tpublic Time getTime(int parameterIndex) throws SQLException ",
"\t\t\tTime v = getParms().getParameterForGet(parameterIndex-1).getTime(getCal());"
]
},
{
"added": [
" public Timestamp getTimestamp(int parameterIndex, Calendar cal)",
" Timestamp v = getParms().",
" getParameterForGet(parameterIndex-1).getTimestamp(cal);"
],
"header": "@@ -441,12 +443,13 @@ public abstract class EmbedCallableStatement extends EmbedPreparedStatement",
"removed": [
" public Timestamp getTimestamp(int parameterIndex)",
"\t\t\tTimestamp v = getParms().getParameterForGet(parameterIndex-1).getTimestamp(getCal());"
]
},
{
"added": [
" public java.sql.Date getDate(int parameterIndex)",
" return getDate(parameterIndex, getCal());"
],
"header": "@@ -462,10 +465,10 @@ public abstract class EmbedCallableStatement extends EmbedPreparedStatement",
"removed": [
" public java.sql.Date getDate(int parameterIndex, Calendar cal) ",
"\t\treturn getDate(parameterIndex);"
]
},
{
"added": [
" public java.sql.Time getTime(int parameterIndex)",
" return getTime(parameterIndex, getCal());"
],
"header": "@@ -476,10 +479,10 @@ public abstract class EmbedCallableStatement extends EmbedPreparedStatement",
"removed": [
" public java.sql.Time getTime(int parameterIndex, Calendar cal) ",
"\t\treturn getTime(parameterIndex);"
]
}
]
}
] |
derby-DERBY-4617-52d42fe9
|
DERBY-4617 Sysinfo.testSysinfoLocale failed with IBM 1.6 on Windows 7 64bit
Wrap getCononicalPath() in sysinfo.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1097247 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/impl/tools/sysinfo/Main.java",
"hunks": [
{
"added": [
"import java.security.PrivilegedActionException;",
"import java.security.PrivilegedExceptionAction;"
],
"header": "@@ -44,6 +44,8 @@ import java.io.InputStream;",
"removed": []
},
{
"added": [
" /**",
" * wrapper for getCanonicalPath for sysinfo. For sysinfo we just want to print",
" * the security exceptions, not throw them if we don't have permmission",
" * ",
" * @param f file on which to call getCanonicalPath",
" * @return f.getCanonicalPath",
" * @throws IOException",
" */",
" private static String getCanonicalPath(final File f) throws IOException {",
"",
" try {",
" return (String) AccessController",
" .doPrivileged(new PrivilegedExceptionAction() {",
" public Object run() throws IOException {",
" return f.getCanonicalPath();",
" }",
" });",
" } catch (PrivilegedActionException pae) {",
" throw (IOException) pae.getCause();",
" } catch (SecurityException se) {",
" return Main.getTextMessage(\"SIF01.I\", se);",
" }",
" }"
],
"header": "@@ -366,6 +368,29 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": []
},
{
"added": [
" zip.setLocation(getCanonicalPath(new File(dirname)).replace('/', File.separatorChar));"
],
"header": "@@ -999,7 +1024,7 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
" zip.setLocation(new File(dirname).getCanonicalPath().replace('/', File.separatorChar));"
]
},
{
"added": [
" zip.setLocation(getCanonicalPath(new File(filename)).replace('/', File.separatorChar));"
],
"header": "@@ -1048,7 +1073,7 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
" zip.setLocation(new File(filename).getCanonicalPath().replace('/', File.separatorChar));"
]
},
{
"added": [
" result = getCanonicalPath(new File(filename)).replace('/', File.separatorChar);"
],
"header": "@@ -1221,7 +1246,7 @@ public static void getMainInfo (java.io.PrintWriter aw, boolean pause) {",
"removed": [
" result = new File(filename).getCanonicalPath().replace('/', File.separatorChar);"
]
}
]
}
] |
derby-DERBY-4619-17a0ba93
|
DERBY-4619: PropertySetter fails due to an empty jre/lib directory
Skip JDK install directories which are empty / invalid (affects only the
old detection algorithm, which is based on directory name recognition).
Patch file: derby-4619-1a-fix_for_empty_libdir.diff
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@936954 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/build/org/apache/derbyPreBuild/PropertySetter.java",
"hunks": [
{
"added": [
" debug( \"\\nPropertySetter environment =\\n\\n\" + showEnvironment() + \"\\n\\n\" );"
],
"header": "@@ -249,10 +249,7 @@ public class PropertySetter extends Task",
"removed": [
" if ( isSet( PROPERTY_SETTER_DEBUG_FLAG ) )",
" {",
" echo( \"\\nPropertySetter environment =\\n\\n\" + showEnvironment() + \"\\n\\n\" );",
" }"
]
},
{
"added": [
" if ( isSet( J14CLASSPATH ) && isSet( J15CLASSPATH ) &&",
" isSet( J16CLASSPATH ) ) {",
" debug(\"All required properties already set.\");",
" return;",
" }"
],
"header": "@@ -263,7 +260,11 @@ public class PropertySetter extends Task",
"removed": [
" if ( isSet( J14CLASSPATH ) && isSet( J15CLASSPATH ) && isSet( J16CLASSPATH ) ) { return; }"
]
},
{
"added": [
" debug(\"Failed to obtain manifest for \" +"
],
"header": "@@ -615,11 +616,9 @@ public class PropertySetter extends Task",
"removed": [
" if (isSet(PROPERTY_SETTER_DEBUG_FLAG)) {",
" echo(\"Failed to obtain manifest for \" +",
" }"
]
},
{
"added": [
" debug(\"found JDK: \" + info);"
],
"header": "@@ -672,9 +671,7 @@ public class PropertySetter extends Task",
"removed": [
" if (isSet(PROPERTY_SETTER_DEBUG_FLAG)) {",
" System.out.println(\"found JDK: \" + info);",
" }"
]
},
{
"added": [
" debug(\"INFO: No valid JDK with specification \" +"
],
"header": "@@ -716,10 +713,8 @@ public class PropertySetter extends Task",
"removed": [
" if (isSet(PROPERTY_SETTER_DEBUG_FLAG)) {",
" System.out.println(\"INFO: No valid JDK with specification \" +",
" }"
]
},
{
"added": [
" debug(\"Chosen JDK for specification version \" +",
" specificationVersion + \" (vendor \" +",
" (targetVendor == null ? \"ignored\"",
" : jdkVendor) +",
" \"): \" + jdk);"
],
"header": "@@ -738,14 +733,11 @@ public class PropertySetter extends Task",
"removed": [
" if (isSet(PROPERTY_SETTER_DEBUG_FLAG)) {",
" System.out.println(",
" \"Chosen JDK for specification version \" +",
" specificationVersion + \" (vendor \" +",
" (targetVendor == null ? \"ignored\"",
" : jdkVendor) +",
" \"): \" + jdk);",
" }"
]
},
{
"added": [
" // Guard against empty JDK library directories.",
" // Can happen if the JDK is uninstalled when there are custom libs in",
" // the jre/lib/ext directory.",
" // This issue only affects the old algorithm for finding JDKs",
" // (looks for specific directory names), which is used as a fallback",
" // when the new algorithm (looks for specific JAR files) doesn't find",
" // the required JDKs.",
" if (jars.length == 0) {",
" debug(\"INFO: Empty or invalid JDK lib directory: \" + dir);",
" return null;",
" }"
],
"header": "@@ -914,6 +906,17 @@ public class PropertySetter extends Task",
"removed": []
},
{
"added": [
" /**",
" * Emits a debug message to the console if debugging is enabled.",
" * <p>",
" * Debugging is controlled by {@linkplain #PROPERTY_SETTER_DEBUG_FLAG}.",
" *",
" * @param msg the message to print",
" */",
" private void debug(CharSequence msg) {",
" if (isSet(PROPERTY_SETTER_DEBUG_FLAG)) {",
" System.out.println(msg);",
" }",
" }"
],
"header": "@@ -1192,5 +1195,17 @@ public class PropertySetter extends Task",
"removed": []
}
]
}
] |
derby-DERBY-4621-95ad00d2
|
DERBY-4621: Invalid conversion from Timestamp to String when calling setTimestamp() with Calendar
Two changes to fix the wrong time and to harmonize the format between
the methods that take a Calendar argument and those that don't:
1) Use 24-hour clock when converting the time component to a string
2) Add a decimal point and a single zero if the nanosecond component
of a Timestamp is zero
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@936215 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/SQLChar.java",
"hunks": [
{
"added": [
" sb.append('.');",
"",
" if (micros == 0)",
" {",
" // Add a single zero after the decimal point to match",
" // the format from Timestamp.toString().",
" sb.append('0');",
" }",
" else if (micros > 0)"
],
"header": "@@ -1564,13 +1564,20 @@ readingLoop:",
"removed": [
" if( micros > 0)",
" sb.append( '.');"
]
}
]
}
] |
derby-DERBY-4624-677364ff
|
DERBY-4624: Broken logic for avoiding testing across midnight in TimestampArithTest
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@946079 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4625-3d03e7db
|
DERBY-4626: Timestamp truncated when converted to string with explicit calendar
Added a test case. The bug was fixed as part of DERBY-4625.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@999485 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4625-c13beb16
|
DERBY-4625: TIMESTAMP function doesn't accept nanoseconds
Patch contributed by C.S. Nirmal J. Fernando <nirmal070125@gmail.com>.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@999479 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4626-3d03e7db
|
DERBY-4626: Timestamp truncated when converted to string with explicit calendar
Added a test case. The bug was fixed as part of DERBY-4625.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@999485 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-0b11ef40
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Test create view with insert rows from join
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1292941 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-54cc8c1e
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Adding test for nested joins.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1290888 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-5e98e518
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Adding test for subqueries.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1290919 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-601800f8
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Test insert into a table with data from JOINs
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1291057 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-783dae78
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Adding test for left and right outer joins with VALUES caluse supplying the data instead of base tables.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1245143 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-841f8df3
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation\
Adding a test case with two join columns
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1228777 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-9e63fcc4
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Test join using global temporary tables
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1293467 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-b0356ec5
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Adding comments to some of the tests, stating that Derby is allowing incorrect behavior because of DERBY-4631. Once the jira is fixed, these tests should start failing and would need to be changed to show the correct behavior.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1231296 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-b7c6a50e
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Rearranged the test code a little bit for reusability purposes.
Adding test for left and right outer joins with views supplying the data instead of base tables.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1245226 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-bba8dbfe
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Test delete from a table with data from JOINs
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1292108 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-ef2328a8
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Testing with more than 2 joins columns
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1294275 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-fbae15db
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation\
Adding a test case with following comments
/**
* Test USING clause and NATURAL JOIN for case insensitive and
* case sensitive collations.
* As per the SQL spec, "the join columns in a natural join or in a named
* columns join should be added to the select list by coalescing the
* column from the left table with the column from the right table. "
* DERBY-4631 - Derby does not coalesce as suggested by SQL spec, instead
* it picks up join column's value from the left table when working with
* natural left outer join and it picks up the join column's value from
* the right table when working with natural right outer join. This works
* ok with non-territory based databases. It works ok for natural left
* outer join for territory based database but depending on the data
* value, it does not always work for natural right outer join in a
* territory based database as shown in the test cases below.
* @throws SQLException
*/
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1228332 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4631-fd4cb7fb
|
DERBY-4631 Wrong join column returned by right outer join with NATURAL or USING and territory-based collation
Adding variations of existing test but using USING clause rather than NATURAL JOIN.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1229266 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4638-6c73d749
|
DERBY-4638: Expose names of top-level test suites for easier scripting
Added public method getTopLevelSuiteNames() to AllPackages to retrieve
the class names of all test suites. Also added a main() method to make
it retrievable from the command line.
Moved ReplicationSuite and EncryptionSuite from All to AllPackages so
that they're included in the returned list.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@941627 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/suites/All.java",
"hunks": [
{
"added": [],
"header": "@@ -25,8 +25,6 @@ import junit.framework.TestSuite;",
"removed": [
"import org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationSuite;",
"import org.apache.derbyTesting.junit.JDBC;"
]
},
{
"added": [
" /**",
" * Generate the {@code suites.All} test suite. Sub-suites should be added",
" * to {@link AllPackages#suite()} and not here.",
" */"
],
"header": "@@ -37,6 +35,10 @@ public class All extends BaseTestCase {",
"removed": []
}
]
},
{
"file": "java/testing/org/apache/derbyTesting/functionTests/suites/AllPackages.java",
"hunks": [
{
"added": [
"import java.util.ArrayList;",
"import java.util.Iterator;",
"import java.util.List;",
"import org.apache.derbyTesting.functionTests.tests.replicationTests.ReplicationSuite;"
],
"header": "@@ -22,12 +22,15 @@ package org.apache.derbyTesting.functionTests.suites;",
"removed": [
"import org.apache.derbyTesting.junit.JDBC;"
]
},
{
"added": [
" for (Iterator it = getTestClasses().iterator(); it.hasNext(); ) {",
" Object testClass = it.next();",
" if (testClass instanceof String) {",
" suite.addTest(addSuiteByReflection((String) testClass));",
" } else {",
" suite.addTest(invokeSuite((Class) testClass));",
" }",
" }",
"",
" return suite;",
" }",
"",
" /**",
" * <p>",
" * Get a list of test classes to add. The classes that have been compiled",
" * with target level equal to the lowest supported level are included as",
" * {@code java.lang.Class} objects. Classes compiled with higher target",
" * levels are included as {@code java.lang.String}s with the class names",
" * so that this method does not fail with class not found errors on some",
" * platforms.",
" * </p>",
" *",
" * <p>",
" * To construct a test suite from these classes, the classes' static",
" * {@code suite()} methods have to be called.",
" * </p>",
" *",
" * @return list of test classes",
" */",
" private static List getTestClasses() {",
" ArrayList classes = new ArrayList();",
"",
" classes.add(org.apache.derbyTesting.functionTests.tests.derbynet._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.lang._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.store._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.tools._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.engine._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.demo._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.memory._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.memorydb._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.i18n._Suite.class);",
" classes.add(org.apache.derbyTesting.functionTests.tests.multi.StressMultiTest.class);",
" classes.add(\"org.apache.derbyTesting.functionTests.tests.jdbc4._Suite\");",
" classes.add(\"org.apache.derbyTesting.functionTests.tests.management._Suite\");",
" classes.add(org.apache.derbyTesting.unitTests.junit._Suite.class);",
" classes.add(",
" org.apache.derbyTesting.functionTests.tests.upgradeTests._Suite.class);",
" // Encrypted tests",
" // J2ME (JSR169) does not support encryption.",
" classes.add(EncryptionSuite.class);",
"",
" // Replication tests. Implementation require DataSource.",
" // Not supp. by JSR169",
" classes.add(ReplicationSuite.class);",
"",
" return classes;",
" * Ignore errors caused by the class version of the test class being",
" * higher than what's supported on this platform.",
" return invokeSuite(Class.forName(className));"
],
"header": "@@ -52,56 +55,90 @@ public class AllPackages extends BaseTestCase {",
"removed": [
" suite.addTest(org.apache.derbyTesting.functionTests.tests.derbynet._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.lang._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.jdbcapi._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.store._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.tools._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.engine._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.demo._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.memory._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.memorydb._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.i18n._Suite.suite());",
" suite.addTest(org.apache.derbyTesting.functionTests.tests.multi.StressMultiTest.suite());",
" suite.addTest(",
" addSuiteByReflection(",
" \"org.apache.derbyTesting.functionTests.tests.jdbc4._Suite\"));",
" suite.addTest(",
" addSuiteByReflection(",
" \"org.apache.derbyTesting.functionTests.tests.management._Suite\"));",
" suite.addTest(org.apache.derbyTesting.unitTests.junit._Suite.suite());",
" suite.addTest(",
" org.apache.derbyTesting.functionTests.tests.upgradeTests._Suite.suite());",
" return suite;",
" Class clz = Class.forName(className);",
" ",
" Method sm = clz.getMethod(\"suite\", null);",
" ",
" return (Test) sm.invoke(null, null);"
]
}
]
}
] |
derby-DERBY-464-25796994
|
DERBY-464: Enforce TRIGGER privilege checks and add tests.
Change createTriggerNode to expect TRIGGER privilege on triggering table.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@381562 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateTriggerNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.Authorizer;"
],
"header": "@@ -38,6 +38,7 @@ import org.apache.derby.iapi.sql.dictionary.SPSDescriptor;",
"removed": []
}
]
}
] |
derby-DERBY-464-2efac287
|
DERBY-464: Submit initial changes to make dblook report GRANT statements in sqlAuthorization mode.
Need to add or change existing test to use sqlAuthorization database.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@387160 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/tools/org/apache/derby/tools/dblook.java",
"hunks": [
{
"added": [
"import org.apache.derby.impl.tools.dblook.DB_GrantRevoke;"
],
"header": "@@ -47,6 +47,7 @@ import org.apache.derby.impl.tools.dblook.DB_Schema;",
"removed": []
},
{
"added": [
"\tprivate static boolean sqlAuthorization;",
""
],
"header": "@@ -79,6 +80,8 @@ public final class dblook {",
"removed": []
},
{
"added": [
"\t\t\tDB_GrantRevoke.doAuthorizations(this.conn);",
""
],
"header": "@@ -535,6 +538,8 @@ public final class dblook {",
"removed": []
},
{
"added": [
"\t\t// Check if sqlAuthorization mode is on. If so, need to generate",
"\t\t// authorization statements.",
"\t\trs = stmt.executeQuery(\"VALUES SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY\" +",
"\t\t\t\t\t\t\"('derby.database.sqlAuthorization')\");",
"\t\tif (rs.next())",
"\t\t{",
"\t\t\tString sqlAuth = rs.getString(1);",
"\t\t\tif (Boolean.valueOf(sqlAuth).booleanValue())",
"\t\t\t\tsqlAuthorization = true;",
"\t\t}"
],
"header": "@@ -604,6 +609,16 @@ public final class dblook {",
"removed": []
},
{
"added": [
"",
"\tpublic static String addSingleQuotes(String name) {",
"",
"\t\tif (name == null)",
"\t\t\treturn null;",
"",
"\t\treturn \"'\" + name + \"'\";",
"\t}",
""
],
"header": "@@ -727,6 +742,15 @@ public final class dblook {",
"removed": []
}
]
}
] |
derby-DERBY-464-50ba36be
|
DERBY-464: Continuation of previous Grant and Revoke checkins. This changes
implement:
1) Schema authorization checks: Only DBA can create a schema with authorization
of another user and regular non-DBA users can only create a schema that matches
their authorizationID in sqlStandard mode.
2) Make database owner authorizationId owner of all system schemas. This is
done in both sqlStandard mode or in legacy mode during database create time.
Need work to test hard upgrade to change system schema owner name to authId
of user doing full database upgrade.
3) Disable switching to sqlStandard mode in soft upgrade mode for 10.2. Since
Grant/Revoke is not enabled in soft upgrade mode in 10.2 release, sqlStandard
mode should be disabled in soft upgrade mode.
4) Disable all authorization checks for DBA user. This includes all object
permission checks and allowing DBA to grant/revoke any privilege on any database
object.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@385610 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/StatementSchemaPermission.java",
"hunks": [
{
"added": [],
"header": "@@ -21,7 +21,6 @@",
"removed": [
"import org.apache.derby.catalog.UUID;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/util/IdUtil.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.reference.Attribute;",
"import org.apache.derby.iapi.reference.Property;",
"import java.util.Properties;",
""
],
"header": "@@ -20,12 +20,16 @@",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.util.IdUtil;"
],
"header": "@@ -37,6 +37,7 @@ import org.apache.derby.iapi.reference.Attribute;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DD_Version.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.util.IdUtil;"
],
"header": "@@ -48,6 +48,7 @@ import org.apache.derby.iapi.services.info.ProductGenusNames;",
"removed": []
},
{
"added": [
"\t\t\t// real upgrade changes. Get user name of current user.",
"\t\t\tString userName = IdUtil.getUserNameFromURLProps(startParams);",
"\t\t\tdoFullUpgrade(tc, dictionaryVersion.majorVersionNumber,IdUtil.getUserAuthorizationId(userName));"
],
"header": "@@ -203,8 +204,9 @@ public\tclass DD_Version implements\tFormatable",
"removed": [
"\t\t\t// real upgrade changes.",
"\t\t\tdoFullUpgrade( tc, dictionaryVersion.majorVersionNumber );"
]
},
{
"added": [
"\t * @param\taid\t\t\t\t\t\tAuthorizationID of current user to be made DBA",
"\tprivate\tvoid\tdoFullUpgrade(TransactionController tc, int fromMajorVersionNumber, String aid)"
],
"header": "@@ -301,10 +303,11 @@ public\tclass DD_Version implements\tFormatable",
"removed": [
"\tprivate\tvoid\tdoFullUpgrade(TransactionController tc, int fromMajorVersionNumber)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.util.IdUtil;"
],
"header": "@@ -132,6 +132,7 @@ import org.apache.derby.iapi.services.io.FormatableBitSet;",
"removed": []
},
{
"added": [
"\tprivate String authorizationDBA;",
""
],
"header": "@@ -328,6 +329,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\t\t\tString userName = IdUtil.getUserNameFromURLProps(startParams);",
"\t\t\t\tauthorizationDBA = IdUtil.getUserAuthorizationId(userName);",
"\t\t\t"
],
"header": "@@ -636,7 +639,9 @@ public final class\tDataDictionaryImpl",
"removed": [
""
]
},
{
"added": [
"\t\t\t\tSchemaDescriptor sd = locateSchemaRow(SchemaDescriptor.IBM_SYSTEM_SCHEMA_NAME,",
"\t\t\t\t\t\t\t\t bootingTC);",
"\t\t\t\tauthorizationDBA = sd.getAuthorizationId();",
"\t\t\tif (SanityManager.DEBUG)",
"\t\t\t\tSanityManager.ASSERT((authorizationDBA != null), \"Failed to get DBA authorization\");",
""
],
"header": "@@ -662,8 +667,14 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t/**",
"\t * Get authorizationID of DBA",
"\t *",
"\t * @return\tauthorizationID",
"\t */",
"\tpublic String getAuthorizationDBA()",
"\t{",
"\t\treturn authorizationDBA;",
"\t}",
""
],
"header": "@@ -1133,6 +1144,16 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t/**",
"\t * Update all system schemas to have new authorizationId. This is needed",
"\t * while upgrading pre-10.2 databases to 10.2 or later versions. From 10.2,",
"\t * all system schemas would be owned by database owner's authorizationId.",
"\t *",
"\t * @param aid\t\t\t\t\t\t\tAuthorizationID of DBA",
"\t * @param tc\t\t\t\t\t\t\tTransactionController to use",
"\t *",
"\t * @exception StandardException\t\tThrown on failure",
"\t */",
"\tpublic void updateSystemSchemaAuthorization(String aid,",
"\t\t\t\t\t\t\t\t\t\t\t\tTransactionController tc)",
"\t\tthrows StandardException",
"\t{",
"\t\tupdateSchemaAuth(SchemaDescriptor.STD_SYSTEM_SCHEMA_NAME, aid, tc);",
"\t\tupdateSchemaAuth(SchemaDescriptor.IBM_SYSTEM_SCHEMA_NAME, aid, tc);",
"",
"\t\tupdateSchemaAuth(SchemaDescriptor.IBM_SYSTEM_CAT_SCHEMA_NAME, aid, tc);",
"\t\tupdateSchemaAuth(SchemaDescriptor.IBM_SYSTEM_FUN_SCHEMA_NAME, aid, tc);",
"\t\tupdateSchemaAuth(SchemaDescriptor.IBM_SYSTEM_PROC_SCHEMA_NAME, aid, tc);",
"\t\tupdateSchemaAuth(SchemaDescriptor.IBM_SYSTEM_STAT_SCHEMA_NAME, aid, tc);",
"\t\tupdateSchemaAuth(SchemaDescriptor.IBM_SYSTEM_NULLID_SCHEMA_NAME, aid, tc);",
"",
"\t\tupdateSchemaAuth(SchemaDescriptor.STD_SQLJ_SCHEMA_NAME, aid, tc);",
"\t\tupdateSchemaAuth(SchemaDescriptor.STD_SYSTEM_DIAG_SCHEMA_NAME, aid, tc);",
"\t\tupdateSchemaAuth(SchemaDescriptor.STD_SYSTEM_UTIL_SCHEMA_NAME, aid, tc);",
"\t}",
"",
"\t/**",
"\t * Update authorizationId of specified schemaName",
"\t *",
"\t * @param schemaName\t\t\tSchema Name of system schema",
"\t * @param authorizationId\t\tauthorizationId of new schema owner",
"\t * @param tc\t\t\t\t\tThe TransactionController to use",
"\t *",
"\t * @exception StandardException\t\tThrown on failure",
"\t */",
"\tpublic void updateSchemaAuth(String schemaName,",
"\t\t\t\t\t\t\t\t String authorizationId,",
"\t\t\t\t\t\t\t\t TransactionController tc)",
"\t\tthrows StandardException",
"\t{",
"\t\tExecIndexRow\t\t\t\tkeyRow;",
"\t\tDataValueDescriptor\t\t\tschemaNameOrderable;",
"\t\tTabInfo\t\t\t\t\t\tti = coreInfo[SYSSCHEMAS_CORE_NUM];",
"",
"\t\t/* Use schemaNameOrderable in both start ",
"\t\t * and stop position for index 1 scan. ",
"\t\t */",
"\t\tschemaNameOrderable = dvf.getVarcharDataValue(schemaName);",
"",
"\t\t/* Set up the start/stop position for the scan */",
"\t\tkeyRow = (ExecIndexRow) exFactory.getIndexableRow(1);",
"\t\tkeyRow.setColumn(1, schemaNameOrderable);",
"",
"\t\tSYSSCHEMASRowFactory\trf = (SYSSCHEMASRowFactory) ti.getCatalogRowFactory();",
"\t\tExecRow row = rf.makeEmptyRow();",
"",
"\t\trow.setColumn(SYSSCHEMASRowFactory.SYSSCHEMAS_SCHEMAAID,",
"\t\t\t\t\t dvf.getVarcharDataValue(authorizationId));",
"",
"\t\tboolean[] bArray = {false, true};",
"",
"\t\tint[] colsToUpdate = {SYSSCHEMASRowFactory.SYSSCHEMAS_SCHEMAAID};",
"",
"\t\tti.updateRow(keyRow, row,",
"\t\t\t\t\t SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX2_ID,",
"\t\t\t\t\t bArray,",
"\t\t\t\t\t colsToUpdate,",
"\t\t\t\t\t tc);",
"\t}",
""
],
"header": "@@ -5354,6 +5375,78 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" authorizationDBA,"
],
"header": "@@ -6139,7 +6232,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" SchemaDescriptor.SA_USER_NAME,"
]
},
{
"added": [
" authorizationDBA,"
],
"header": "@@ -8103,7 +8196,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" SchemaDescriptor.SA_USER_NAME,"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateSchemaNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.CompilerContext;",
"import org.apache.derby.iapi.sql.conn.Authorizer;",
""
],
"header": "@@ -31,6 +31,9 @@ import org.apache.derby.iapi.sql.dictionary.DataDictionary;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.Authorizer;"
],
"header": "@@ -27,6 +27,7 @@ import org.apache.derby.iapi.sql.ResultSet;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java",
"hunks": [
{
"added": [
"\t\t{",
"\t\t\t// Raise error if DD version is not less than 10.2",
"\t\t\tgetDataDictionary().checkVersion(DataDictionary.DD_VERSION_DERBY_10_2, \"sqlAuthorization\");",
"\t\t}"
],
"header": "@@ -309,7 +309,11 @@ public class GenericLanguageConnectionContext",
"removed": []
},
{
"added": [
"\t\tauthorizer = new GenericAuthorizer(IdUtil.getUserAuthorizationId(userName),this, sqlConnection);"
],
"header": "@@ -331,7 +335,7 @@ public class GenericLanguageConnectionContext",
"removed": [
"\t\tauthorizer = new GenericAuthorizer(getAuthorizationId(userName),this, sqlConnection);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/PrivilegeInfo.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.dictionary.DataDictionary;"
],
"header": "@@ -23,6 +23,7 @@ package org.apache.derby.impl.sql.execute;",
"removed": []
}
]
}
] |
derby-DERBY-464-5ec85106
|
DERBY-464: Continuation of Grant & Revoke feature checkins. This batch of changes address:
1) Introduce new property derby.database.sqlAuthorization to turn on SQL standard authorization model. Default authorization is still Derby legacy authorization model, with NO support for GRANT/REVOKE.
2) If this property is set to TRUE as system property, all new databases get created with sqlAuthorization to TRUE. If this property is set at a database level, authorization mode would be switched to SQL standard mode at next database boot time.
3) Remove all changes made to defaultConnectionMode property. This property was the previous way to enable GRANT/REVOKE.
4) Disable any changes to sqlAuthorization property once SQL standard authorization is enabled. This is done to prevent switching back to Derby legacy authorization model.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@386867 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/reference/Property.java",
"hunks": [
{
"added": [
"\t/*",
"\t\tProperty to enable Grant & Revoke SQL authorization. Introduced in Derby 10.2",
"\t\trelease. New databases and existing databases (in Derby 10.2) still use legacy",
"\t\tauthorization by default and by setting this property to true could request for",
"\t\tSQL standard authorization model.",
"\t */",
"\tpublic static final String",
"\tSQL_AUTHORIZATION_PROPERTY = \"derby.database.sqlAuthorization\";",
""
],
"header": "@@ -613,6 +613,15 @@ public interface Property {",
"removed": []
},
{
"added": [],
"header": "@@ -620,7 +629,6 @@ public interface Property {",
"removed": [
"\tpublic static final String SQL_STANDARD_ACCESS = \"sqlStandard\";"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/LanguageDbPropertySetter.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.reference.SQLState;",
"import org.apache.derby.iapi.services.context.ContextService;"
],
"header": "@@ -23,8 +23,10 @@ package org.apache.derby.impl.sql;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"\tprivate boolean usesSqlAuthorization;"
],
"header": "@@ -330,6 +330,7 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\t\t\t// If SqlAuthorization is set as system property during database",
"\t\t\t\t// creation, set it as database property also, so it gets persisted.",
"\t\t\t\tif (PropertyUtil.getSystemBoolean(Property.SQL_AUTHORIZATION_PROPERTY))",
"\t\t\t\t{",
"\t\t\t\t\tbootingTC.setProperty(Property.SQL_AUTHORIZATION_PROPERTY,\"true\",true);",
"\t\t\t\t\tusesSqlAuthorization=true;",
"\t\t\t\t}",
"",
"\t\t\t\tString sqlAuth = PropertyUtil.getDatabaseProperty(bootingTC,",
"\t\t\t\t\t\t\t\t\t\tProperty.SQL_AUTHORIZATION_PROPERTY);",
"\t\t\t\tif (Boolean.valueOf(sqlAuth).booleanValue())",
"\t\t\t\t{",
"\t\t\t\t\t// SQL authorization requires 10.2 or higher database",
"\t\t\t\t\tcheckVersion(DataDictionary.DD_VERSION_DERBY_10_2, \"sqlAuthorization\");",
"\t\t\t\t\tusesSqlAuthorization=true;",
"\t\t\t\t}"
],
"header": "@@ -664,12 +665,28 @@ public final class\tDataDictionaryImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/conn/GenericAuthorizer.java",
"hunks": [
{
"added": [],
"header": "@@ -48,7 +48,6 @@ implements Authorizer",
"removed": [
"\tprivate static final int SQL_STANDARD_ACCESS = 3;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java",
"hunks": [
{
"added": [],
"header": "@@ -189,7 +189,6 @@ public class GenericLanguageConnectionContext",
"removed": [
"\tprotected boolean usesSqlPermissions = false;"
]
},
{
"added": [],
"header": "@@ -304,17 +303,6 @@ public class GenericLanguageConnectionContext",
"removed": [
"\t\t// GrantRevoke TODO: May need to make database property value override system value",
"\t\tString modeS = PropertyUtil.getServiceProperty(getTransactionCompile(),",
"\t\t\t\t\t\t\t\t\tProperty.DEFAULT_CONNECTION_MODE_PROPERTY);",
"\t\tif (modeS != null &&",
"\t\t\t StringUtil.SQLEqualsIgnoreCase(modeS, Property.SQL_STANDARD_ACCESS))",
"\t\t{",
"\t\t\t// Raise error if DD version is not less than 10.2",
"\t\t\tgetDataDictionary().checkVersion(DataDictionary.DD_VERSION_DERBY_10_2, \"sqlAuthorization\");",
"\t\t\tusesSqlPermissions = true;",
"\t\t}",
""
]
}
]
}
] |
derby-DERBY-464-70a12d9b
|
DERBY-464: Enable routine privilege checking. Most of the code for routine
privileges is already in trunk. Just enable this checking, add tests to both
grantRevokeDDL and grantRevoke tests.
Permission scheme for system routines still need to be resolved. For now,
everyone has execute permission on all system routines in system schemas.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@381408 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-464-b7730e46
|
DERBY-464: Submit Grant & Revoke Part I. This implements the new DDL operations along with the following:
* Grant/Revoke DDL parsing and execution
* Addition of several new system tables to hold the system metadata. I will update my spec to include detailed schema for new system tables, so that they can be included in 10.2 documentation.
* Enhancing the syntax for routine creation to include external-security clause
* Very simple tests to cover only the DDL. I would be expanding on the testing in the later submissions, including a JUnit test suite.
* Grant/Revoke DDL is only supported if derby.database.defaultConnectionMode property is set to 'sqlStandard'.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@356133 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/reference/Property.java",
"hunks": [
{
"added": [
" /**",
" * The size of the permissions cache used by the data dictionary.",
" * Database. Static.",
"\t * <p>",
"\t * Undocumented.",
"\t */",
"\tString\tLANG_PERMISSIONS_CACHE_SIZE = \"derby.language.permissionsCacheSize\";",
"\tint\t\tLANG_PERMISSIONS_CACHE_SIZE_DEFAULT = 64;"
],
"header": "@@ -524,6 +524,14 @@ public interface Property {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/reference/SQLState.java",
"hunks": [
{
"added": [
"\tString LANG_AMBIGUOUS_FUNCTION_NAME = \"42X46\";",
"\tString LANG_AMBIGUOUS_PROCEDURE_NAME = \"42X47\";"
],
"header": "@@ -765,8 +765,8 @@ public interface SQLState {",
"removed": [
"\t// = \"42X46\";",
"\t// = \"42X47\";"
]
},
{
"added": [
"\tString LANG_GRANT_REVOKE_WITH_LEGACY_ACCESS = \"42Z60\";",
""
],
"header": "@@ -957,6 +957,8 @@ public interface SQLState {",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/compile/C_NodeTypes.java",
"hunks": [
{
"added": [
"\tstatic final int REVOKE_NODE = 86;",
"\tstatic final int GRANT_NODE = 89;"
],
"header": "@@ -115,10 +115,10 @@ public interface C_NodeTypes",
"removed": [
"\t// 86 available",
"\t// 89 available"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/compile/CompilerContext.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.TableDescriptor;"
],
"header": "@@ -30,6 +30,9 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"removed": []
},
{
"added": [
"import java.util.List;"
],
"header": "@@ -43,6 +46,7 @@ import org.apache.derby.iapi.types.DataTypeDescriptor;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/conn/Authorizer.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.Activation;"
],
"header": "@@ -20,6 +20,7 @@",
"removed": []
},
{
"added": [
"\t/* Privilege types for SQL standard (grant/revoke) permissions checking. */",
"\tpublic static final int NULL_PRIV = -1;",
"\tpublic static final int SELECT_PRIV = 0;",
"\tpublic static final int UPDATE_PRIV = 1;",
"\tpublic static final int REFERENCES_PRIV = 2;",
"\tpublic static final int INSERT_PRIV = 3;",
"\tpublic static final int DELETE_PRIV = 4;",
"\tpublic static final int TRIGGER_PRIV = 5;",
"\tpublic static final int EXECUTE_PRIV = 6;",
"\tpublic static final int PRIV_TYPE_COUNT = 7;",
"",
"\t/**",
"\t * The system authorization ID is defined by the SQL2003 spec as the grantor",
"\t * of privileges to object owners.",
"\t */",
"\tpublic static final String SYSTEM_AUTHORIZATION_ID = \"_SYSTEM\";",
"",
"\t/**",
"\t * The public authorization ID is defined by the SQL2003 spec as implying all users.",
"\t */",
"\tpublic static final String PUBLIC_AUTHORIZATION_ID = \"PUBLIC\";",
"",
"\t This variation should only be used with operations that do not use tables",
"\t or routines. If the operation involves tables or routines then use the",
"\t variation of the authorize method that takes an Activation parameter. The",
"\t activation holds the table, column, and routine lists.",
"",
"\tpublic void authorize( int operation) throws StandardException;",
" ",
"\t/**",
"\t Verify the connected user is authorized to perform the requested",
"\t operation.",
"",
"\t @param activation holds the list of tables, columns, and routines used.",
"\t @param operation the enumeration code for the requsted operation.",
"",
"\t @exception StandardException Thrown if the operation is not allowed",
"\t*/",
"\tpublic void authorize(Activation activation, int operation)",
"\t\t\t\tthrows StandardException;"
],
"header": "@@ -46,15 +47,54 @@ public interface Authorizer",
"removed": [
"\tpublic void authorize(int operation) throws StandardException;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDescriptorGenerator.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.io.FormatableBitSet;"
],
"header": "@@ -32,6 +32,7 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/DataDictionary.java",
"hunks": [
{
"added": [],
"header": "@@ -42,7 +42,6 @@ import org.apache.derby.catalog.UUID;",
"removed": [
""
]
},
{
"added": [
"\tpublic static final int SYSTABLEPERMS_CATALOG_NUM = 16;",
"\tpublic static final int SYSCOLPERMS_CATALOG_NUM = 17;",
"\tpublic static final int SYSROUTINEPERMS_CATALOG_NUM = 18;",
"\tpublic static final int SYSREQUIREDPERM_CATALOG_NUM = 19;"
],
"header": "@@ -131,6 +130,10 @@ public interface DataDictionary",
"removed": []
},
{
"added": [
"\t * the constraintId passed in."
],
"header": "@@ -679,7 +682,7 @@ public interface DataDictionary",
"removed": [
"\t * the constraintId passsed in."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.Authorizer;",
"import org.apache.derby.iapi.sql.dictionary.PermissionsCatalogRowFactory;"
],
"header": "@@ -24,9 +24,11 @@ import org.apache.derby.iapi.reference.JDBC30Translation;",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.ColPermsDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.RoutinePermsDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.PermissionsDescriptor;"
],
"header": "@@ -45,6 +47,10 @@ import org.apache.derby.iapi.sql.dictionary.GenericDescriptorList;",
"removed": []
},
{
"added": [],
"header": "@@ -250,8 +256,6 @@ public final class\tDataDictionaryImpl",
"removed": [
"\tprivate\tstatic final int\t\tNUM_NONCORE = 12;",
""
]
},
{
"added": [
"\t\t\t\t\t\t\t\t\t\"SYSDUMMY1\",",
" \"SYSTABLEPERMS\",",
" \"SYSCOLPERMS\",",
" \"SYSROUTINEPERMS\",",
" \"SYSREQUIREDPERM\"",
"\tprivate\tstatic final int\t\tNUM_NONCORE = nonCoreNames.length;",
""
],
"header": "@@ -266,9 +270,15 @@ public final class\tDataDictionaryImpl",
"removed": [
"\t\t\t\t\t\t\t\t\t\"SYSDUMMY1\""
]
},
{
"added": [
" /* Cache of permissions data */",
" CacheManager permissionsCache;",
" int permissionsCacheSize;",
""
],
"header": "@@ -333,6 +343,10 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\tvalue = startParams.getProperty(Property.LANG_PERMISSIONS_CACHE_SIZE);",
"\t\tpermissionsCacheSize = PropertyUtil.intPropertyValue(Property.LANG_PERMISSIONS_CACHE_SIZE, value,",
"\t\t\t\t\t\t\t\t\t 0, Integer.MAX_VALUE, Property.LANG_PERMISSIONS_CACHE_SIZE_DEFAULT);",
""
],
"header": "@@ -524,6 +538,10 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" private CacheManager getPermissionsCache() throws StandardException",
" {",
" if( permissionsCache == null)",
" {",
" CacheFactory cf =",
" (CacheFactory) Monitor.startSystemModule(org.apache.derby.iapi.reference.Module.CacheFactory);",
" LanguageConnectionContext lcc = getLCC();",
" TransactionController tc = lcc.getTransactionExecute();",
" permissionsCacheSize = PropertyUtil.getServiceInt( tc,",
" Property.LANG_PERMISSIONS_CACHE_SIZE,",
" 40, /* min value */",
" Integer.MAX_VALUE,",
" permissionsCacheSize /* value from boot time. */);",
" permissionsCache = cf.newCacheManager( this,",
" \"PermissionsCache\",",
" permissionsCacheSize,",
" permissionsCacheSize);",
" }",
" return permissionsCache;",
" } // end of getPermissionsCache",
""
],
"header": "@@ -643,6 +661,27 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" else if( cm == permissionsCache)",
" return new PermissionsCacheable(this);"
],
"header": "@@ -680,6 +719,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"",
"\t\t\t case SYSTABLEPERMS_CATALOG_NUM:",
"\t\t\t\tretval = new TabInfoImpl(new SYSTABLEPERMSRowFactory(",
"\t\t\t\t\t\t\t\t\t\t\t\t luuidFactory, exFactory, dvf, convertIdToLower));\t\t\t\t\t ",
"\t\t\t\tbreak;",
"",
"\t\t\t case SYSCOLPERMS_CATALOG_NUM:",
"\t\t\t\tretval = new TabInfoImpl(new SYSCOLPERMSRowFactory(",
"\t\t\t\t\t\t\t\t\t\t\t\t luuidFactory, exFactory, dvf, convertIdToLower));\t\t\t\t\t ",
"\t\t\t\tbreak;",
"",
"\t\t\t case SYSROUTINEPERMS_CATALOG_NUM:",
"\t\t\t\tretval = new TabInfoImpl(new SYSROUTINEPERMSRowFactory(",
"\t\t\t\t\t\t\t\t\t\t\t\t luuidFactory, exFactory, dvf, convertIdToLower));\t\t\t\t\t ",
"\t\t\t\tbreak;",
"",
"\t\t\t case SYSREQUIREDPERM_CATALOG_NUM:",
"\t\t\t\tretval = new TabInfoImpl(new SYSREQUIREDPERMRowFactory(",
"\t\t\t\t\t\t\t\t\t\t\t\t luuidFactory, exFactory, dvf, convertIdToLower));\t\t\t\t\t ",
"\t\t\t\tbreak;"
],
"header": "@@ -7551,6 +7592,26 @@ public final class\tDataDictionaryImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/C_NodeNames.java",
"hunks": [
{
"added": [
"\tstatic final String GRANT_NODE_NAME = \"org.apache.derby.impl.sql.compile.GrantNode\";",
" "
],
"header": "@@ -142,6 +142,8 @@ public interface C_NodeNames",
"removed": []
},
{
"added": [
"\tstatic final String PRIVILEGE_NAME = \"org.apache.derby.impl.sql.compile.PrivilegeNode\";",
""
],
"header": "@@ -202,6 +204,8 @@ public interface C_NodeNames",
"removed": []
},
{
"added": [
"\tstatic final String REVOKE_NODE_NAME = \"org.apache.derby.impl.sql.compile.RevokeNode\";",
" "
],
"header": "@@ -212,6 +216,8 @@ public interface C_NodeNames",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CompilerContextImpl.java",
"hunks": [
{
"added": [
"import org.apache.derby.catalog.UUID;",
""
],
"header": "@@ -20,6 +20,8 @@",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.sql.conn.Authorizer;",
"import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.TableDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.AliasDescriptor;",
"import org.apache.derby.iapi.sql.dictionary.StatementTablePermission;",
"import org.apache.derby.iapi.sql.dictionary.StatementColumnPermission;",
"import org.apache.derby.iapi.sql.dictionary.StatementRoutinePermission;"
],
"header": "@@ -27,9 +29,16 @@ import org.apache.derby.iapi.sql.compile.CompilerContext;",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.services.io.FormatableBitSet;"
],
"header": "@@ -52,6 +61,7 @@ import org.apache.derby.iapi.services.loader.ClassFactory;",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.util.ReuseFactory;",
"import java.util.HashMap;",
"import java.util.Iterator;",
"import java.util.Map.Entry;",
"import java.util.BitSet;",
"import java.util.List;",
"import java.util.Stack;",
"import java.util.ArrayList;"
],
"header": "@@ -60,10 +70,18 @@ import org.apache.derby.iapi.reference.SQLState;",
"removed": []
},
{
"added": [
"\t\tinitRequiredPriv();"
],
"header": "@@ -130,6 +148,7 @@ public class CompilerContextImpl extends ContextImpl",
"removed": []
},
{
"added": [
"",
"\t\tinitRequiredPriv();",
"\t}",
"",
"\tprivate void initRequiredPriv()",
"\t{",
"\t\tcurrPrivType = Authorizer.NULL_PRIV;",
"\t\tprivTypeStack.clear();",
"\t\trequiredColumnPrivileges = null;",
"\t\trequiredTablePrivileges = null;",
"\t\trequiredRoutinePrivileges = null;",
"\t\ttry",
"\t\t{",
"\t\t\tLanguageConnectionContext lcc = (LanguageConnectionContext)",
"\t\t\tgetContextManager().getContext(LanguageConnectionContext.CONTEXT_ID);",
"\t\t\tif( lcc.getAuthorizer().usesSqlStandardPermissions())",
"\t\t\t{",
"\t\t\t\trequiredColumnPrivileges = new HashMap();",
"\t\t\t\trequiredTablePrivileges = new HashMap();",
"\t\t\t\trequiredRoutinePrivileges = new HashMap();",
"\t\t\t}",
"\t\t}",
"\t\tcatch( StandardException se){}",
"\t} // end of initRequiredPriv",
"",
"\t/**",
"\t * Sets the current privilege type context. Column and table nodes do not know",
"\t * how they are being used. Higher level nodes in the query tree do not know what",
"\t * is being referenced.",
"\t * Keeping the context allows the two to come together.",
"\t *",
"\t * @param privType One of the privilege types in org.apache.derby.iapi.sql.conn.Authorizer.",
"\t */",
"\tpublic void pushCurrentPrivType( int privType)",
"\t{",
"\t\tprivTypeStack.push( ReuseFactory.getInteger( currPrivType));",
"\t\tcurrPrivType = privType;",
"\tpublic void popCurrentPrivType( )",
"\t{",
"\t\tcurrPrivType = ((Integer) privTypeStack.pop()).intValue();",
"\t}",
"\t",
"\t/**",
"\t * Add a column privilege to the list of used column privileges.",
"\t *",
"\t * @param column",
"\t */",
"\tpublic void addRequiredColumnPriv( ColumnDescriptor column)",
"\t{",
"\t\tif( requiredColumnPrivileges == null // Using old style authorization",
"\t\t\t|| currPrivType == Authorizer.NULL_PRIV",
"\t\t\t|| currPrivType == Authorizer.DELETE_PRIV // Table privilege only",
"\t\t\t|| currPrivType == Authorizer.INSERT_PRIV // Table privilege only",
"\t\t\t|| currPrivType == Authorizer.TRIGGER_PRIV // Table privilege only",
"\t\t\t|| currPrivType == Authorizer.EXECUTE_PRIV",
"\t\t\t|| column == null)",
"\t\t\treturn;",
"\t\tTableDescriptor td = column.getTableDescriptor();",
"\t\tUUID tableUUID = td.getUUID();",
"\t\tStatementTablePermission key = new StatementTablePermission( tableUUID, currPrivType);",
"\t\tStatementColumnPermission tableColumnPrivileges",
"\t\t = (StatementColumnPermission) requiredColumnPrivileges.get( key);",
"\t\tif( tableColumnPrivileges == null)",
"\t\t{",
"\t\t\ttableColumnPrivileges = new StatementColumnPermission( tableUUID,",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t currPrivType,",
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t new FormatableBitSet( td.getNumberOfColumns()));",
"\t\t\trequiredColumnPrivileges.put( key, tableColumnPrivileges);",
"\t\t}",
"\t\ttableColumnPrivileges.getColumns().set( column.getPosition() - 1);",
"\t} // end of addRequiredColumnPriv",
"",
"\t/**",
"\t * Add a table or view privilege to the list of used table privileges.",
"\t *",
"\t * @param table",
"\t */",
"\tpublic void addRequiredTablePriv( TableDescriptor table)",
"\t{",
"\t\tif( requiredTablePrivileges == null || table == null)",
"\t\t\treturn;",
"",
"\t\tStatementTablePermission key = new StatementTablePermission( table.getUUID(), currPrivType);",
"\t\trequiredTablePrivileges.put( key, key);",
"\t}",
"",
"\t/**",
"\t * Add a routine execute privilege to the list of used routine privileges.",
"\t *",
"\t * @param routine",
"\t */",
"\tpublic void addRequiredRoutinePriv( AliasDescriptor routine)",
"\t{",
"\t\t// routine == null for built in routines",
"\t\tif( requiredRoutinePrivileges == null || routine == null)",
"\t\t\treturn;",
"\t\tif( requiredRoutinePrivileges.get( routine.getUUID()) == null)",
"\t\t\trequiredRoutinePrivileges.put( routine.getUUID(), ReuseFactory.getInteger(1));",
"\t}",
"",
"\t/**",
"\t * @return The list of required privileges.",
"\t */",
"\tpublic List getRequiredPermissionsList()",
"\t{",
"\t\tint size = 0;",
"\t\tif( requiredRoutinePrivileges != null)",
"\t\t\tsize += requiredRoutinePrivileges.size();",
"\t\tif( requiredTablePrivileges != null)",
"\t\t\tsize += requiredTablePrivileges.size();",
"\t\tif( requiredColumnPrivileges != null)",
"\t\t\tsize += requiredColumnPrivileges.size();",
"\t\t",
"\t\tArrayList list = new ArrayList( size);",
"\t\tif( requiredRoutinePrivileges != null)",
"\t\t{",
"\t\t\tfor( Iterator itr = requiredRoutinePrivileges.keySet().iterator(); itr.hasNext();)",
"\t\t\t{",
"\t\t\t\tUUID routineUUID = (UUID) itr.next();",
"\t\t\t\t",
"\t\t\t\tlist.add( new StatementRoutinePermission( routineUUID));",
"\t\t\t}",
"\t\t}",
"\t\tif( requiredTablePrivileges != null)",
"\t\t{",
"\t\t\tfor( Iterator itr = requiredTablePrivileges.values().iterator(); itr.hasNext();)",
"\t\t\t{",
"\t\t\t\tlist.add( itr.next());",
"\t\t\t}",
"\t\t}",
"\t\tif( requiredColumnPrivileges != null)",
"\t\t{",
"\t\t\tfor( Iterator itr = requiredColumnPrivileges.values().iterator(); itr.hasNext();)",
"\t\t\t{",
"\t\t\t\tlist.add( itr.next());",
"\t\t\t}",
"\t\t}",
"\t\treturn list;",
"\t} // end of getRequiredPermissionsList",
""
],
"header": "@@ -663,8 +682,148 @@ public class CompilerContextImpl extends ContextImpl",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java",
"hunks": [
{
"added": [
"\t\t\t\t// 9 - Boolean - externalSecurity (false for invoker, true for definer)"
],
"header": "@@ -119,6 +119,7 @@ public class CreateAliasNode extends CreateStatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java",
"hunks": [
{
"added": [
"\t * Bind the result columns by their names. This is useful for GRANT and REVOKE statements",
" * like \"GRANT SELECT ON t(c1,c1,c3) TO george\", where the user specified a column list.",
"\t * This method does not check for duplicate column names.",
"\t *",
"\t * @param tableDescriptor\tThe descriptor for the table",
"\t *",
"\t * @return\tNothing",
"\t *",
"\t * @exception StandardException\t\tThrown on error",
"\t */",
"\tpublic void bindResultColumnsByName(TableDescriptor targetTableDescriptor)",
"\t\t\t\t\tthrows StandardException",
"\t{",
"\t\tint\t\t\tsize = size();",
"",
"\t\tfor (int index = 0; index < size; index++)",
"\t\t{",
"\t\t\tResultColumn rc = (ResultColumn) elementAt(index);",
"",
"\t\t\trc.bindResultColumnByName(",
"\t\t\t\t\t\ttargetTableDescriptor,",
"\t\t\t\t\t\tindex + 1",
"\t\t\t\t\t);",
"\t\t}",
"\t} // end of bindResultColumnsByName( TableDescriptor)",
"",
"\t/**",
"\t * Bind the result columns by their names. This is useful for update, grant, and revoke",
"\t * If the statment is an insert or update verify that the result column list does not contain any duplicates.",
"\t * @param statement\t\t\tDMLStatementNode containing this list, null if no duplicate checking is to be done",
"\t * @return A FormatableBitSet representing the set of columns with respect to the table",
"\tpublic FormatableBitSet bindResultColumnsByName(TableDescriptor targetTableDescriptor,",
" DMLStatementNode statement)",
"\t\tFormatableBitSet columnBitSet = new FormatableBitSet( targetTableDescriptor.getNumberOfColumns());",
"\t\t\trc.bindResultColumnByName(",
"\t\t\t\t\t\ttargetTableDescriptor,",
"\t\t\t\t\t\tindex + 1",
"\t\t\t\t\t);",
" int colIdx = rc.getColumnPosition() - 1;",
" if( SanityManager.DEBUG)",
" SanityManager.ASSERT( colIdx >= 0 && colIdx < targetTableDescriptor.getNumberOfColumns(),",
" \"Invalid column position found for \" + rc.getName());",
"\t\t\t/* Verify that this column's name is unique within the list if requested */",
" if( statement != null && columnBitSet.isSet( colIdx))",
" {",
" String colName = rc.getName();"
],
"header": "@@ -595,46 +595,72 @@ public class ResultColumnList extends QueryTreeNodeVector",
"removed": [
"\t * Bind the result columns by their names. This is useful for update",
"\t * Also, verify that the result column list does not contain any duplicates.",
"\t * @param statement\t\t\tDMLStatementNode containing this list",
"\t * @return\tNothing",
"\tpublic void bindResultColumnsByName(TableDescriptor targetTableDescriptor,",
"\t\t\t\t\t\tDMLStatementNode statement)",
"\t\tHashtable\tht = new Hashtable(size + 2, (float) .999);",
"\t\t\t/* Verify that this column's name is unique within the list */",
"\t\t\tString colName = rc.getName();",
"",
"\t\t\tObject object = ht.put(colName, colName);",
"\t\t\tif (object != null &&",
"\t\t\t\t((String) object).equals(colName))",
"\t\t\t{",
"\t\t\t\tif (SanityManager.DEBUG)",
"\t\t\t\t{",
"\t\t\t\t\tSanityManager.ASSERT((statement instanceof UpdateNode) ||",
"\t\t\t\t\t\t\t\t\t\t (statement instanceof InsertNode),",
"\t\t\t\t\t\t\"statement is expected to be instanceof UpdateNode or InsertNode\");",
"\t\t\t\t}"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/conn/GenericAuthorizer.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.Activation;"
],
"header": "@@ -20,6 +20,7 @@",
"removed": []
},
{
"added": [
"import org.apache.derby.iapi.sql.dictionary.DataDictionary;",
"import org.apache.derby.iapi.sql.dictionary.StatementPermission;",
"import org.apache.derby.iapi.store.access.TransactionController;",
"",
"import java.util.List;",
"import java.util.Iterator;"
],
"header": "@@ -31,7 +32,13 @@ import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;",
"removed": []
},
{
"added": [
"\tprivate static final int SQL_STANDARD_ACCESS = 3;"
],
"header": "@@ -41,6 +48,7 @@ implements Authorizer",
"removed": []
},
{
"added": [
"\t/**",
"\t Used for operations that do not involve tables or routines.",
" ",
"\t @see Authorizer#authorize",
"\t @exception StandardException Thrown if the operation is not allowed",
"\t*/",
"\tpublic void authorize( int operation) throws StandardException",
"\t{",
"\t\tauthorize( (Activation) null, operation);",
"\t}",
"",
"\tpublic void authorize( Activation activation, int operation) throws StandardException"
],
"header": "@@ -81,11 +89,22 @@ implements Authorizer",
"removed": [
"\tpublic void authorize(int operation) throws StandardException"
]
},
{
"added": [
"",
" if( activation != null)",
" {",
" List requiredPermissionsList = null;",
"\t\t\t// GrantRevoke TODO: Need this logic for enforcing permissions later.",
"\t\t\t// List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();",
" if( requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())",
" {",
" DataDictionary dd = lcc.getDataDictionary();",
" TransactionController tc = activation.getTransactionController();",
" for( Iterator iter = requiredPermissionsList.iterator();",
" iter.hasNext();)",
" {",
" ((StatementPermission) iter.next()).check( tc, dd, authorizationId, false);",
" } ",
" }",
"\t\t}"
],
"header": "@@ -124,6 +143,23 @@ implements Authorizer",
"removed": []
},
{
"added": [
""
],
"header": "@@ -178,6 +214,7 @@ implements Authorizer",
"removed": []
},
{
"added": [
"\t\telse if(StringUtil.SQLEqualsIgnoreCase(modeS, Property.SQL_STANDARD_ACCESS))",
" return FULL_ACCESS; "
],
"header": "@@ -190,6 +227,8 @@ implements Authorizer",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java",
"hunks": [
{
"added": [
"import java.util.List;"
],
"header": "@@ -52,6 +52,7 @@ import org.apache.derby.catalog.AliasInfo;",
"removed": []
}
]
}
] |
derby-DERBY-464-d78ad2ef
|
DERBY-464: More checkins to implement Grant & Revoke functionality as defined
by functional spec. This round of changes address:
1) Adding schema creation privilege checks for implicitly created schemas as
well. Previous checkin addressed explicitly created schemas.
2) Disable grant/revoke operations on system tables or system routines not in
SQLJ or SYSCS_UTIL schemas. These objects should always be available for
SELECT or EXECUTE operations as approriate.
3) Add RoutinePermDescriptors during database creation for routines that can
be executed by public. Currently 5 routines have EXECUTE privilege to PUBLIC.
It should be possible to execute these routines on a new database.
Add functional tests to test each of these.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@386283 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java",
"hunks": [
{
"added": [
" *",
" * @return UUID \t\tUUID of system routine that got created.",
" private final UUID createSystemProcedureOrFunction("
],
"header": "@@ -8297,10 +8297,12 @@ public final class\tDataDictionaryImpl",
"removed": [
" private final void createSystemProcedureOrFunction("
]
},
{
"added": [
"\t\tUUID routine_uuid = getUUIDFactory().createUUID();",
" routine_uuid,"
],
"header": "@@ -8358,10 +8360,11 @@ public final class\tDataDictionaryImpl",
"removed": [
" getUUIDFactory().createUUID(),"
]
},
{
"added": [
"",
"\t\treturn routine_uuid;"
],
"header": "@@ -8376,6 +8379,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\tUUID routine_uuid = null;"
],
"header": "@@ -8399,6 +8404,7 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" routine_uuid = createSystemProcedureOrFunction("
],
"header": "@@ -8449,7 +8455,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" createSystemProcedureOrFunction("
]
},
{
"added": [
"",
"\t\t\tcreateRoutinePermPublicDescriptor(routine_uuid, tc);"
],
"header": "@@ -8459,6 +8465,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" routine_uuid = createSystemProcedureOrFunction("
],
"header": "@@ -8586,7 +8594,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" createSystemProcedureOrFunction("
]
},
{
"added": [
"",
"\t\t\tcreateRoutinePermPublicDescriptor(routine_uuid, tc);"
],
"header": "@@ -8596,6 +8604,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" routine_uuid = createSystemProcedureOrFunction("
],
"header": "@@ -8609,7 +8619,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" createSystemProcedureOrFunction("
]
},
{
"added": [
"",
"\t\t\tcreateRoutinePermPublicDescriptor(routine_uuid, tc);"
],
"header": "@@ -8619,6 +8629,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" routine_uuid = createSystemProcedureOrFunction("
],
"header": "@@ -8683,7 +8695,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" createSystemProcedureOrFunction("
]
},
{
"added": [
"",
"\t\t\tcreateRoutinePermPublicDescriptor(routine_uuid, tc);"
],
"header": "@@ -8701,6 +8713,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t/**",
"\t * Create RoutinePermDescriptor to grant access to PUBLIC for",
"\t * this system routine. Currently only SYSUTIL routines need access",
"\t * granted to execute them when a database is created.",
"\t *",
"\t * @param routineUUID uuid of the routine",
"\t * @param tc\t\t\tTransactionController to use",
"\t *",
"\t * @exception StandardException Standard exception policy.",
"\t */",
"\tvoid createRoutinePermPublicDescriptor(",
"\tUUID routineUUID,",
"\tTransactionController tc) throws StandardException",
"\t{",
"\t\tRoutinePermsDescriptor routinePermDesc =",
"\t\t\tnew RoutinePermsDescriptor(",
"\t\t\t\tthis,",
"\t\t\t\t\"PUBLIC\",",
"\t\t\t\tauthorizationDBA,",
"\t\t\t\troutineUUID);",
"",
"\t\taddDescriptor(",
" \t\t\troutinePermDesc, null, DataDictionary.SYSROUTINEPERMS_CATALOG_NUM, false, tc);",
"\t}"
],
"header": "@@ -9471,6 +9485,30 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
"\t\tUUID routine_uuid = null;",
""
],
"header": "@@ -9489,6 +9527,8 @@ public final class\tDataDictionaryImpl",
"removed": []
},
{
"added": [
" routine_uuid = createSystemProcedureOrFunction("
],
"header": "@@ -9519,7 +9559,7 @@ public final class\tDataDictionaryImpl",
"removed": [
" createSystemProcedureOrFunction("
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/DDLStatementNode.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.compile.CompilerContext;"
],
"header": "@@ -27,6 +27,7 @@ import org.apache.derby.iapi.sql.ResultSet;",
"removed": []
},
{
"added": [
"\t\tCompilerContext cc = getCompilerContext();"
],
"header": "@@ -224,6 +225,7 @@ abstract class DDLStatementNode extends StatementNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/PrivilegeNode.java",
"hunks": [
{
"added": [
" if (sd.isSystemSchema())",
" throw StandardException.newException(SQLState.AUTH_GRANT_REVOKE_NOT_ALLOWED, tableName.getFullTableName());",
"\t\t\t\t"
],
"header": "@@ -110,6 +110,9 @@ public class PrivilegeNode extends QueryTreeNode",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java",
"hunks": [
{
"added": [
"\t\tgetCompilerContext().addRequiredRoutinePriv(ad);"
],
"header": "@@ -235,6 +235,7 @@ public class StaticMethodCallNode extends MethodCallNode",
"removed": []
},
{
"added": [],
"header": "@@ -284,7 +285,6 @@ public class StaticMethodCallNode extends MethodCallNode",
"removed": [
"\t\tgetCompilerContext().addRequiredRoutinePriv(ad);"
]
}
]
}
] |
derby-DERBY-464-eb8b3a23
|
DERBY-464: This batch of Grant & Revoke changes include:
1) Prevent GRANT statements on Synonyms, VTIs and Views (for now...pending more changes).
2) Change interface to StatementPermission objects... Dan suggested changing interface to include LCC.
Submitted by Satheesh Bandaram (satheesh@sourcery.org)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@388775 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/StatementColumnPermission.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;"
],
"header": "@@ -25,7 +25,7 @@ import org.apache.derby.catalog.UUID;",
"removed": [
"import org.apache.derby.iapi.store.access.TransactionController;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/StatementPermission.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;"
],
"header": "@@ -20,7 +20,7 @@",
"removed": [
"import org.apache.derby.iapi.store.access.TransactionController;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/StatementRoutinePermission.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;"
],
"header": "@@ -23,6 +23,7 @@ package org.apache.derby.iapi.sql.dictionary;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/StatementSchemaPermission.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;"
],
"header": "@@ -24,6 +24,7 @@ import org.apache.derby.iapi.error.StandardException;",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/sql/dictionary/StatementTablePermission.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;"
],
"header": "@@ -23,8 +23,8 @@ package org.apache.derby.iapi.sql.dictionary;",
"removed": [
"import org.apache.derby.iapi.store.access.TransactionController;"
]
},
{
"added": [
"\t * Constructor for StatementTablePermission. Creates an instance of",
"\t * table permission requested for the given access."
],
"header": "@@ -36,8 +36,8 @@ public class StatementTablePermission extends StatementPermission",
"removed": [
"\t * Constructor for StatementTablePermission. Creates an instance of table permission requested",
"\t * for the given access."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/conn/GenericAuthorizer.java",
"hunks": [
{
"added": [
" ((StatementPermission) iter.next()).check( lcc, authorizationId, false);"
],
"header": "@@ -151,11 +151,10 @@ implements Authorizer",
"removed": [
" TransactionController tc = activation.getTransactionController();",
" ((StatementPermission) iter.next()).check( tc, dd, authorizationId, false);"
]
}
]
}
] |
derby-DERBY-4646-8badf993
|
DERBY-4179 bootLock.java fails with missing exception on z/OS with pmz3160sr2ifix-20081021_01(SR2+IZ32776+IZ33456), and Windows Vista
Patch derby-4179-junit-5:
* Rewrite of boot lock test to JUnit, this also solves the problem
with running with jars in relative classpaths.
* Added test of effectiveness of derby.database.forceDatabaseLock for
phoneME platforms, until we implement DERBY-4646. (I could not find
any other such test).
* Fixed JUnit harness to correctly fork a Sun phoneME vm (image name
is cvm, not java),
* Added logic to capture what happens to minion (if it fails) by
capturing its stderr (if it ever gets started, that is), cf. example enclosed.
* Added socket logic to communicate to parent when minion has booted
the "dual boot" candidate to avoid having to wait for 30 seconds or
more to be sure it has done so. Test now runs in a few seconds.
* Skips test for j9 for now, since this platform fails on the fork
operation according to Kathey, cf DERBY-4647.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@942286 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java",
"hunks": [
{
"added": [
"",
" /**",
" * Decorate a test to use a new database that is created upon the first",
" * connection request to the database and shutdown & deleted at",
" * tearDown. The configuration differs only from the current configuration",
" * by the list of used databases. The generated database name is added at",
" * the end of <code>usedDbNames</code> and assigned as a default database",
" * name. This decorator expects the database file to be local so it can be",
" * removed.",
" * @param test Test to be decorated",
" * @param dbName We sometimes need to know outside to be able topass it on",
" * to other VMs/processes.",
" * @return decorated test.",
" */",
" public static TestSetup singleUseDatabaseDecorator(Test test, String dbName)",
" {",
" return new DatabaseChangeSetup(",
" new DropDatabaseSetup(test, dbName), dbName, dbName, true);",
" }",
""
],
"header": "@@ -664,6 +664,26 @@ public class TestConfiguration {",
"removed": []
}
]
}
] |
derby-DERBY-4647-8badf993
|
DERBY-4179 bootLock.java fails with missing exception on z/OS with pmz3160sr2ifix-20081021_01(SR2+IZ32776+IZ33456), and Windows Vista
Patch derby-4179-junit-5:
* Rewrite of boot lock test to JUnit, this also solves the problem
with running with jars in relative classpaths.
* Added test of effectiveness of derby.database.forceDatabaseLock for
phoneME platforms, until we implement DERBY-4646. (I could not find
any other such test).
* Fixed JUnit harness to correctly fork a Sun phoneME vm (image name
is cvm, not java),
* Added logic to capture what happens to minion (if it fails) by
capturing its stderr (if it ever gets started, that is), cf. example enclosed.
* Added socket logic to communicate to parent when minion has booted
the "dual boot" candidate to avoid having to wait for 30 seconds or
more to be sure it has done so. Test now runs in a few seconds.
* Skips test for j9 for now, since this platform fails on the fork
operation according to Kathey, cf DERBY-4647.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@942286 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/junit/TestConfiguration.java",
"hunks": [
{
"added": [
"",
" /**",
" * Decorate a test to use a new database that is created upon the first",
" * connection request to the database and shutdown & deleted at",
" * tearDown. The configuration differs only from the current configuration",
" * by the list of used databases. The generated database name is added at",
" * the end of <code>usedDbNames</code> and assigned as a default database",
" * name. This decorator expects the database file to be local so it can be",
" * removed.",
" * @param test Test to be decorated",
" * @param dbName We sometimes need to know outside to be able topass it on",
" * to other VMs/processes.",
" * @return decorated test.",
" */",
" public static TestSetup singleUseDatabaseDecorator(Test test, String dbName)",
" {",
" return new DatabaseChangeSetup(",
" new DropDatabaseSetup(test, dbName), dbName, dbName, true);",
" }",
""
],
"header": "@@ -664,6 +664,26 @@ public class TestConfiguration {",
"removed": []
}
]
}
] |
derby-DERBY-4647-8f56d99d
|
DERBY-4249 Create a simple store recovery test in JUnit
Contributed by Siddharth Srivastava
Simple test to verify recovery.
- Connect, create a table, commit and shutdown the database.
- fork a jvm, add one row, commit, add another row, exit the jvm.
- Reconnect with the first jvm and verify that the first row is there and the second is not.
Launches a junit method for forked jvm and reports any errors back.
Currently disabled for weme due to DERBY-4647.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1158949 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4647-ce62de66
|
DERBY-4647 BaseTestCase.execJavaCmd() does not work with weme 6.2
Fix execJavaCmd to pass -jcl:foun11. Enable BootLockTest and RecoveryTest with weme. Changed BootLockTest to only force the database lock with PhoneME, not weme (j9)
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1161208 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4650-de4c68fb
|
DERBY-4650: Predicates in HAVING clause should be pushed down to restricted VTIs
Added a test case that shows that a predicate is not pushed down.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@943088 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4651-92d8fc50
|
DERBY-4651: Add a test case to verify that the VTI does not return the wrong results in simple cases which attempt to put constant expressions into the WHERE clause.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@943605 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4651-9e26886d
|
DERBY-4651: Raise an exception rather than return wrong results in this problem scenario.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@943633 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromVTI.java",
"hunks": [
{
"added": [
" // strip off trailing vacuous TRUE constant if present",
" if (",
" andOperator.getRightOperand() instanceof BooleanConstantNode &&",
" ( ((BooleanConstantNode) andOperator.getRightOperand()).isBooleanTrue() )",
" )"
],
"header": "@@ -1331,8 +1331,11 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
" // strip off trailing vacuous constant if present",
" if ( andOperator.getRightOperand() instanceof BooleanConstantNode )"
]
},
{
"added": [
" // strip off trailing vacuous FALSE constant if present",
" if (",
" orOperator.getRightOperand() instanceof BooleanConstantNode &&",
" ( ((BooleanConstantNode) orOperator.getRightOperand()).isBooleanFalse() )",
" )"
],
"header": "@@ -1346,8 +1349,11 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
" // strip off trailing vacuous constant if present",
" if ( orOperator.getRightOperand() instanceof BooleanConstantNode )"
]
}
]
}
] |
derby-DERBY-4651-f6957647
|
DERBY-4651: Hidden assumptions in FromVTI.makeRestriction()
Remove redundant type checks and casts when calling isBooleanTrue()
and isBooleanFalse().
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@944174 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/FromVTI.java",
"hunks": [
{
"added": [
" if ( andOperator.getRightOperand().isBooleanTrue() )"
],
"header": "@@ -1332,10 +1332,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
" if (",
" andOperator.getRightOperand() instanceof BooleanConstantNode &&",
" ( ((BooleanConstantNode) andOperator.getRightOperand()).isBooleanTrue() )",
" )"
]
},
{
"added": [
" if ( orOperator.getRightOperand().isBooleanFalse() )"
],
"header": "@@ -1350,10 +1347,7 @@ public class FromVTI extends FromTable implements VTIEnvironment",
"removed": [
" if (",
" orOperator.getRightOperand() instanceof BooleanConstantNode &&",
" ( ((BooleanConstantNode) orOperator.getRightOperand()).isBooleanFalse() )",
" )"
]
}
]
}
] |
derby-DERBY-4653-89c399d4
|
DERBY-4653 Avoid unnecessary round-trip for commit in the client driver
Contributed by Lily Wei lilywei at yahoo dot com
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@957053 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4654-9c18d668
|
DERBY-4654: Restriction.toSQL() doesn't escape special characters
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@944152 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/vti/Restriction.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.util.IdUtil;"
],
"header": "@@ -21,7 +21,7 @@",
"removed": [
"import java.sql.SQLException;"
]
},
{
"added": [],
"header": "@@ -40,9 +40,6 @@ public abstract class Restriction implements Serializable",
"removed": [
" /** Utility method to double quote a string */",
" protected String doubleQuote( String raw ) { return \"\\\"\" + raw + \"\\\"\"; }",
""
]
}
]
}
] |
derby-DERBY-4657-a5848888
|
DERBY-4657: Allow functions to return BOOLEAN values.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@944386 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4658-31342ae6
|
DERBY-4658: Allow explicit casts of string values to BOOLEAN
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@955666 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4658-f903d9ba
|
DERBY-4658: Allow explicit casts of string values to BOOLEAN
Removed unnecessary call to setNullability() and added a test that
verified that the correct nullability had been set.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@955940 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4659-4bad5591
|
DERBY-4659: Allow BOOLEAN args in procedures.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@957650 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4659-9a625275
|
DERBY-4659: Allow functions to take BOOLEAN args.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@956563 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4659-a6b18af1
|
DERBY-4659: Add regression test for getFunctionColumns() for functions with BOOLEAN arguments.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@956970 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4661-85de1e49
|
DERBY-4661: Reduce size of encoding buffer for short character values
Patch consists of two main parts:
- buffer size reduction
- added StreamHeaderGenerator.getMaxHeaderLength() (used in size calculation)
In addition a redundant call to LimitReader.setLimit is removed, the constant
READ_BUFFER_RESERVATION is introduced (and used), and a few typos are corrected.
Patch file: derby-4661-1b-reduce_encoding_bz.diff
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@948069 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/iapi/types/ReaderToUTF8Stream.java",
"hunks": [
{
"added": [
" /** Buffer space reserved for one 3 byte encoded char and the EOF marker. */",
" private final static int READ_BUFFER_RESERVATION = 6;"
],
"header": "@@ -51,6 +51,8 @@ public final class ReaderToUTF8Stream",
"removed": []
},
{
"added": [
" * UTF-8 format. The initial size is dependent on whether the data value",
" * length is known (limited upwards to 32 KB), but it may grow if",
" private byte[] buffer;"
],
"header": "@@ -58,10 +60,11 @@ public final class ReaderToUTF8Stream",
"removed": [
" * UTF-8 format. The initial size is 32 KB, but it may grow if the",
" private byte[] buffer = new byte[32*1024];"
]
},
{
"added": [
" * stream length exceeds the maximum length of the column we are inserting"
],
"header": "@@ -83,7 +86,7 @@ public final class ReaderToUTF8Stream",
"removed": [
" * stream length execeeds the maximum length of the column we are inserting"
]
},
{
"added": [
"",
" int absValueLength = Math.abs(valueLength);",
" reader.setLimit(absValueLength);"
],
"header": "@@ -124,11 +127,13 @@ public final class ReaderToUTF8Stream",
"removed": [
" reader.setLimit(valueLength);"
]
},
{
"added": [
" // Optimization for small values, where we reduce the memory",
" // requirement during encoding/insertion.",
" // Be conservative, assume three bytes per char.",
" int bz = 32*1024; // 32 KB default",
" if (absValueLength < bz / 3) {",
" // Enforce a minimum size of the buffer, otherwise read may loop",
" // indefinitely (must enter for loop in fillBuffer to detect EOF).",
" bz = hdrGen.getMaxHeaderLength() +",
" Math.max(READ_BUFFER_RESERVATION, absValueLength * 3 +3);",
" }",
" buffer = new byte[bz];"
],
"header": "@@ -138,6 +143,17 @@ public final class ReaderToUTF8Stream",
"removed": []
},
{
"added": [],
"header": "@@ -167,7 +183,6 @@ public final class ReaderToUTF8Stream",
"removed": [
" reader.setLimit(maximumLength);"
]
},
{
"added": [
" int spaceRequired = readAheadLimit + READ_BUFFER_RESERVATION;"
],
"header": "@@ -325,7 +340,7 @@ public final class ReaderToUTF8Stream",
"removed": [
" int spaceRequired = readAheadLimit + 6;"
]
},
{
"added": [
" for (; off <= buffer.length - READ_BUFFER_RESERVATION; )"
],
"header": "@@ -347,7 +362,7 @@ public final class ReaderToUTF8Stream",
"removed": [
"\t\tfor (; off <= buffer.length - 6; )"
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/SQLClob.java",
"hunks": [
{
"added": [],
"header": "@@ -57,10 +57,6 @@ import java.util.Calendar;",
"removed": [
"",
" /** The maximum number of bytes used by the stream header. */",
" private static final int MAX_STREAM_HEADER_LENGTH = 5;",
""
]
}
]
},
{
"file": "java/engine/org/apache/derby/iapi/types/StreamHeaderGenerator.java",
"hunks": [
{
"added": [
"",
" /**",
" * Returns the maximum length of the header.",
" *",
" * @return Max header length in bytes.",
" */",
" int getMaxHeaderLength();"
],
"header": "@@ -86,4 +86,11 @@ public interface StreamHeaderGenerator {",
"removed": []
}
]
}
] |
derby-DERBY-4664-a4521052
|
DERBY-4664 Change Derby internal stored procedures to avoid DriverManager.getConnection("jdbc:default:connection") as it may be recognized by other Drivers
This fix is really a work around for DERBY-4668 for internal procedures.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@946794 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java",
"hunks": [
{
"added": [
"import java.sql.Connection;",
"import org.apache.derby.jdbc.InternalDriver;"
],
"header": "@@ -23,12 +23,14 @@ package org.apache.derby.impl.jdbc;",
"removed": []
},
{
"added": [
" //DERBY-4664 Do not use DriverManager(\"jdbc:default:connection\") because",
" // some other product's Driver might hijack our stored procedure.",
" InternalDriver id = InternalDriver.activeDriver();",
" if (id != null) { ",
" EmbedConnection conn = (EmbedConnection) id.connect(\"jdbc:default:connection\", null);",
" if (conn != null)",
" return conn;",
" }",
" throw Util.noCurrentConnection();",
" "
],
"header": "@@ -389,8 +391,16 @@ public class LOBStoredProcedure {",
"removed": [
" return (EmbedConnection)DriverManager",
" .getConnection(\"jdbc:default:connection\");"
]
}
]
}
] |
derby-DERBY-4665-f2a8dbd5
|
DERBY-4665: Unidiomatic error handling in TimestampArithTest
Use helper methods that preserve the stack trace on errors instead
of printing to the console and exiting.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@946188 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4667-30efca7c
|
DERBY-4667 BootLockTest.testBootLock() sometimes fails with connection refused.
Move the vm logic for Derby151Test outside of the fixture so network server won't start if no tests are run. This may not correct the problem and even if it does may be a fragile fix, but it giving it a try to see if the prior test Derby151Test is interfering if no fixtures are run but network server is stopped and started.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@950818 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4667-b976fd86
|
DERBY-4667 BootLockTest.testBootLock() sometimes fails with connection refused.
Change test to check service.properties in additon to db.lck file so that it won't fail with a directory already exists message.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@956659 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4667-c8bb7d7a
|
DERBY-4667 BootLockTest.testBootLock() sometimes fails with connection refused.
Removed socket syncrhonization. Test will just wait for spawned java program
to create the lock file.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@956075 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4668-a4521052
|
DERBY-4664 Change Derby internal stored procedures to avoid DriverManager.getConnection("jdbc:default:connection") as it may be recognized by other Drivers
This fix is really a work around for DERBY-4668 for internal procedures.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@946794 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/LOBStoredProcedure.java",
"hunks": [
{
"added": [
"import java.sql.Connection;",
"import org.apache.derby.jdbc.InternalDriver;"
],
"header": "@@ -23,12 +23,14 @@ package org.apache.derby.impl.jdbc;",
"removed": []
},
{
"added": [
" //DERBY-4664 Do not use DriverManager(\"jdbc:default:connection\") because",
" // some other product's Driver might hijack our stored procedure.",
" InternalDriver id = InternalDriver.activeDriver();",
" if (id != null) { ",
" EmbedConnection conn = (EmbedConnection) id.connect(\"jdbc:default:connection\", null);",
" if (conn != null)",
" return conn;",
" }",
" throw Util.noCurrentConnection();",
" "
],
"header": "@@ -389,8 +391,16 @@ public class LOBStoredProcedure {",
"removed": [
" return (EmbedConnection)DriverManager",
" .getConnection(\"jdbc:default:connection\");"
]
}
]
}
] |
derby-DERBY-467-6bc98979
|
DERBY-467 Make some public & protected classes and members in the org.apache.derby.impl.sql.execute package
have more secure protection by making them private or package protected.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@367619 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DMLVTIResultSet.java",
"hunks": [
{
"added": [
"\tNoPutResultSet sourceResultSet;",
"\tNoPutResultSet savedSource;",
"\tUpdatableVTIConstantAction\tconstants;",
"\tTransactionController \ttc;",
" ResultDescription \t\tresultDescription;",
"\tboolean\t\t\t\tfirstExecute;"
],
"header": "@@ -45,17 +45,14 @@ abstract class DMLVTIResultSet extends DMLWriteResultSet",
"removed": [
"\tprotected NoPutResultSet sourceResultSet;",
"\tpublic NoPutResultSet savedSource;",
"\tpublic\tUpdatableVTIConstantAction\tconstants;",
"\tpublic\tTransactionController \ttc;",
"\tpublic\tLanguageConnectionContext\t\t\tlcc;",
" public\tResultDescription \t\tresultDescription;",
"\tprotected boolean\t\t\t\tfirstExecute;",
"",
"\tpublic\tExecRow\t\t\t\t\trow;"
]
},
{
"added": [
" DMLVTIResultSet(NoPutResultSet source, "
],
"header": "@@ -70,7 +67,7 @@ abstract class DMLVTIResultSet extends DMLWriteResultSet",
"removed": [
" public DMLVTIResultSet(NoPutResultSet source, "
]
},
{
"added": [],
"header": "@@ -78,7 +75,6 @@ abstract class DMLVTIResultSet extends DMLWriteResultSet",
"removed": [
"\t\tlcc = activation.getLanguageConnectionContext();"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java",
"hunks": [
{
"added": [
"class DeleteResultSet extends DMLWriteResultSet",
"\tprivate TransactionController \ttc;",
"\tDeleteConstantAction\t\tconstants;",
"\tNoPutResultSet\t\t\tsavedSource;",
"\tprivate ExecRow\t\t\t\t\trow;"
],
"header": "@@ -61,19 +61,18 @@ import org.apache.derby.iapi.sql.execute.ExecIndexRow;",
"removed": [
"public class DeleteResultSet extends DMLWriteResultSet",
"\tpublic TransactionController \ttc;",
"\tpublic DeleteConstantAction\t\tconstants;",
"\tpublic NoPutResultSet\t\t\tsavedSource;",
"\tpublic ExecRow\t\t\t\t\trow;",
"\tpublic\t\tLanguageConnectionContext lcc;"
]
},
{
"added": [
" DeleteResultSet"
],
"header": "@@ -109,7 +108,7 @@ public class DeleteResultSet extends DMLWriteResultSet",
"removed": [
" public DeleteResultSet"
]
},
{
"added": [
" DeleteResultSet"
],
"header": "@@ -127,7 +126,7 @@ public class DeleteResultSet extends DMLWriteResultSet",
"removed": [
" protected DeleteResultSet"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/DeleteVTIResultSet.java",
"hunks": [
{
"added": [
"class DeleteVTIResultSet extends DMLVTIResultSet"
],
"header": "@@ -41,7 +41,7 @@ import java.util.Properties;",
"removed": [
"public class DeleteVTIResultSet extends DMLVTIResultSet"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java",
"hunks": [
{
"added": [
"class InsertResultSet extends DMLWriteResultSet implements TargetResultSet"
],
"header": "@@ -105,7 +105,7 @@ import java.util.Vector;",
"removed": [
"public class InsertResultSet extends DMLWriteResultSet implements TargetResultSet"
]
},
{
"added": [
"\tNoPutResultSet\t\t\tsavedSource;",
"\tInsertConstantAction\tconstants;",
"\tprivate ResultSet\t\t\tautoGeneratedKeysResultSet;",
" private\tResultDescription \t\tresultDescription;",
"\tprivate\tTransactionController \ttc;",
"\tprivate\tExecRow\t\t\t\t\trow;",
"\tboolean\t\t\t\t\tuserSpecifiedBulkInsert;",
"\tboolean\t\t\t\t\tbulkInsertPerformed;"
],
"header": "@@ -113,27 +113,25 @@ public class InsertResultSet extends DMLWriteResultSet implements TargetResultSe",
"removed": [
"\tpublic NoPutResultSet\t\t\tsavedSource;",
"\tpublic\tInsertConstantAction\tconstants;",
"\tpublic ResultSet\t\t\tautoGeneratedKeysResultSet;",
" public\tResultDescription \t\tresultDescription;",
"\tpublic\tTransactionController \ttc;",
"\tpublic\tExecRow\t\t\t\t\trow;",
"",
"\tpublic\tLanguageConnectionContext\t\t\tlcc;",
"\tpublic\tboolean\t\t\t\t\tuserSpecifiedBulkInsert;",
"\tpublic\tboolean\t\t\t\t\tbulkInsertPerformed;"
]
},
{
"added": [
" InsertResultSet(NoPutResultSet source, "
],
"header": "@@ -338,7 +336,7 @@ public class InsertResultSet extends DMLWriteResultSet implements TargetResultSe",
"removed": [
" public InsertResultSet(NoPutResultSet source, "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/InsertVTIResultSet.java",
"hunks": [
{
"added": [
"class InsertVTIResultSet extends DMLVTIResultSet"
],
"header": "@@ -48,7 +48,7 @@ import java.util.Properties;",
"removed": [
"public class InsertVTIResultSet extends DMLVTIResultSet"
]
},
{
"added": [
"\t\tExecRow row = getNextRowCore(sourceResultSet);"
],
"header": "@@ -95,7 +95,7 @@ public class InsertVTIResultSet extends DMLVTIResultSet",
"removed": [
"\t\trow = getNextRowCore(sourceResultSet);"
]
},
{
"added": [],
"header": "@@ -105,14 +105,7 @@ public class InsertVTIResultSet extends DMLVTIResultSet",
"removed": [
"\t\tnormalInsertCore(lcc, firstExecute);",
"\t} // end of openCore",
"",
"\t// Do the work for a \"normal\" insert",
"\tprivate void normalInsertCore(LanguageConnectionContext lcc, boolean firstExecute)",
"\t\tthrows StandardException",
"\t{"
]
},
{
"added": [
"\t\t\t\tinsertIntoVTI(rs, row);"
],
"header": "@@ -157,7 +150,7 @@ public class InsertVTIResultSet extends DMLVTIResultSet",
"removed": [
"\t\t\t\tinsertIntoVTI(rs);"
]
},
{
"added": [
"\t\t\t\twhile ((row = tempRS.getNextRow()) != null)",
"\t\t\t\t\tinsertIntoVTI(rs, row);"
],
"header": "@@ -182,13 +175,10 @@ public class InsertVTIResultSet extends DMLVTIResultSet",
"removed": [
" ExecRow\tdeferredRowBuffer = null;",
"",
"\t\t\t\twhile ((deferredRowBuffer = tempRS.getNextRow()) != null)",
"\t\t\t\t\trow = deferredRowBuffer;",
"\t\t\t\t\tinsertIntoVTI(rs);"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java",
"hunks": [
{
"added": [
"\tfinal Activation activation;",
"\tNoPutResultSet[]\tsubqueryTrackingArray;"
],
"header": "@@ -79,10 +79,9 @@ import java.sql.SQLWarning;",
"removed": [
"\tprotected final Activation activation;",
"\tprivate boolean isTopResultSet = true;",
"\tprotected NoPutResultSet[]\tsubqueryTrackingArray;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/RowChangerImpl.java",
"hunks": [
{
"added": [
"class RowChangerImpl\timplements\tRowChanger"
],
"header": "@@ -51,7 +51,7 @@ import java.util.Vector;",
"removed": [
"public class RowChangerImpl\timplements\tRowChanger"
]
},
{
"added": [
"\tprivate int[]\t\tbaseRowReadMap;\t//index=heap column, value=input row column."
],
"header": "@@ -69,7 +69,7 @@ public class RowChangerImpl\timplements\tRowChanger",
"removed": [
"\tprotected int[]\t\tbaseRowReadMap;\t//index=heap column, value=input row column."
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java",
"hunks": [
{
"added": [
"class UpdateResultSet extends DMLWriteResultSet",
"\tprivate TransactionController \ttc;",
"\tprivate ExecRow\t\t\t\t\tnewBaseRow;",
"\tprivate ExecRow \t\t\t\t\trow;",
"\tprivate ExecRow \t\t\t\t\tdeferredSparseRow;",
"\tUpdateConstantAction\t\tconstants;",
"\tNoPutResultSet\t\t\tsavedSource;"
],
"header": "@@ -68,17 +68,17 @@ import java.util.Hashtable;",
"removed": [
"public class UpdateResultSet extends DMLWriteResultSet",
"\tpublic TransactionController \ttc;",
"\tpublic ExecRow\t\t\t\t\tnewBaseRow;",
"\tpublic ExecRow \t\t\t\t\trow;",
"\tpublic ExecRow \t\t\t\t\tdeferredSparseRow;",
"\tpublic UpdateConstantAction\t\tconstants;",
"\tpublic\tNoPutResultSet\t\t\tsavedSource;"
]
},
{
"added": [],
"header": "@@ -87,7 +87,6 @@ public class UpdateResultSet extends DMLWriteResultSet",
"removed": [
"\tpublic\tLanguageConnectionContext lcc;"
]
},
{
"added": [
" UpdateResultSet(NoPutResultSet source,"
],
"header": "@@ -133,7 +132,7 @@ public class UpdateResultSet extends DMLWriteResultSet",
"removed": [
" public UpdateResultSet(NoPutResultSet source,"
]
},
{
"added": [
" UpdateResultSet(NoPutResultSet source,"
],
"header": "@@ -153,7 +152,7 @@ public class UpdateResultSet extends DMLWriteResultSet",
"removed": [
" public UpdateResultSet(NoPutResultSet source,"
]
},
{
"added": [
" UpdateResultSet(NoPutResultSet source,"
],
"header": "@@ -179,7 +178,7 @@ public class UpdateResultSet extends DMLWriteResultSet",
"removed": [
" public UpdateResultSet(NoPutResultSet source,"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/UpdateVTIResultSet.java",
"hunks": [
{
"added": [
"class UpdateVTIResultSet extends DMLVTIResultSet"
],
"header": "@@ -44,7 +44,7 @@ import java.util.Properties;",
"removed": [
"public class UpdateVTIResultSet extends DMLVTIResultSet"
]
},
{
"added": [
"\t\tExecRow row = getNextRowCore(sourceResultSet);"
],
"header": "@@ -71,7 +71,7 @@ public class UpdateVTIResultSet extends DMLVTIResultSet",
"removed": [
"\t\trow = getNextRowCore(sourceResultSet);"
]
},
{
"added": [
" updateVTI(rs, row);"
],
"header": "@@ -120,7 +120,7 @@ public class UpdateVTIResultSet extends DMLVTIResultSet",
"removed": [
" updateVTI( rs);"
]
},
{
"added": [
"\t\t\t\twhile ((row = tempRS.getNextRow()) != null)",
"\t\t\t\t\tupdateVTI(rs, row);"
],
"header": "@@ -152,15 +152,12 @@ public class UpdateVTIResultSet extends DMLVTIResultSet",
"removed": [
" ExecRow\tdeferredRowBuffer = null;",
"",
"\t\t\t\twhile ((deferredRowBuffer = tempRS.getNextRow()) != null)",
"\t\t\t\t\trow = deferredRowBuffer;",
"\t\t\t\t\tupdateVTI(rs);"
]
},
{
"added": [
"\tprivate void updateVTI(ResultSet target, ExecRow row)"
],
"header": "@@ -181,7 +178,7 @@ public class UpdateVTIResultSet extends DMLVTIResultSet",
"removed": [
"\tprivate void updateVTI(ResultSet target)"
]
}
]
}
] |
derby-DERBY-467-7a92d1fc
|
DERBY-467 Remove direct access to privilige blocks by making classes/methods as private
as possible, either private or package protected if possible. Also make such classes and
methods final wherever possible.
git-svn-id: https://svn.apache.org/repos/asf/incubator/derby/code/trunk@220015 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/ClientThread.java",
"hunks": [
{
"added": [
"final class ClientThread extends Thread {"
],
"header": "@@ -24,7 +24,7 @@ import java.io.*;",
"removed": [
"class ClientThread extends Thread {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/ExportWriteData.java",
"hunks": [
{
"added": [
" ExportWriteData(String outputFileName, ControlInfo controlFileReader)"
],
"header": "@@ -41,7 +41,7 @@ final class ExportWriteData extends ExportWriteDataAbstract",
"removed": [
" public ExportWriteData(String outputFileName, ControlInfo controlFileReader)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/ImportAbstract.java",
"hunks": [
{
"added": [
" ControlInfo controlFileReader;",
" ImportReadData importReadData;",
" String[] columnNames;",
" int numberOfColumns;",
" int[] columnWidths;",
" String[] nextRow;",
" ResultSetMetaData importResultSetMetaData;",
" int noOfColumnsExpected;",
"\tstatic final String COLUMNNAMEPREFIX = \"COLUMN\";",
" abstract ImportReadData getImportReadData() throws Exception;",
" void doAllTheWork() throws Exception {"
],
"header": "@@ -32,28 +32,28 @@ import java.util.ArrayList;",
"removed": [
" protected ControlInfo controlFileReader;",
" protected ImportReadData importReadData;",
" protected String[] columnNames;",
" protected int numberOfColumns;",
" protected int[] columnWidths;",
" protected String[] nextRow;",
" protected ResultSetMetaData importResultSetMetaData;",
" protected int noOfColumnsExpected;",
"\tprotected static final String COLUMNNAMEPREFIX = \"COLUMN\";",
" protected abstract ImportReadData getImportReadData() throws Exception;",
" protected void doAllTheWork() throws Exception {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/load/ImportReadData.java",
"hunks": [
{
"added": [
" ImportReadData(String inputFileName, ControlInfo controlFileReader)"
],
"header": "@@ -133,7 +133,7 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {",
"removed": [
" public ImportReadData(String inputFileName, ControlInfo controlFileReader)"
]
},
{
"added": [
" int getNumberOfColumns() {"
],
"header": "@@ -147,7 +147,7 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {",
"removed": [
" public int getNumberOfColumns() {"
]
},
{
"added": [
" void closeStream() throws Exception {"
],
"header": "@@ -262,7 +262,7 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {",
"removed": [
" public void closeStream() throws Exception {"
]
},
{
"added": [
" int findNumberOfColumnsInARow() throws Exception {"
],
"header": "@@ -270,7 +270,7 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {",
"removed": [
" public int findNumberOfColumnsInARow() throws Exception {"
]
},
{
"added": [
" boolean readTokensUntilEndOfRecord() throws Exception {"
],
"header": "@@ -358,7 +358,7 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {",
"removed": [
" public boolean readTokensUntilEndOfRecord() throws Exception {"
]
},
{
"added": [
" int getCurrentRowNumber() {",
" boolean readNextRow(String[] returnStringArray) throws Exception {"
],
"header": "@@ -610,14 +610,14 @@ final class ImportReadData implements java.security.PrivilegedExceptionAction {",
"removed": [
" public int getCurrentRowNumber() {",
" public boolean readNextRow(String[] returnStringArray) throws Exception {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/BaseMonitor.java",
"hunks": [
{
"added": [
"abstract class BaseMonitor"
],
"header": "@@ -100,7 +100,7 @@ import java.net.URL;",
"removed": [
"public abstract class BaseMonitor"
]
},
{
"added": [
"\tHashtable serviceProviders;",
"\tVector[] implementationSets;",
"\tProperties bootProperties;\t\t// specifc properties provided by the boot method, override everything else",
"\tProperties applicationProperties;"
],
"header": "@@ -108,17 +108,17 @@ public abstract class BaseMonitor",
"removed": [
"\tprotected Hashtable serviceProviders;",
"\tprotected Vector[] implementationSets;",
"\tprotected Properties bootProperties;\t\t// specifc properties provided by the boot method, override everything else",
"\tprotected Properties applicationProperties;"
]
},
{
"added": [
"\tboolean reportOn;",
"\tThreadGroup daemonGroup;"
],
"header": "@@ -128,10 +128,10 @@ public abstract class BaseMonitor",
"removed": [
"\tprotected boolean reportOn;",
"\tprotected ThreadGroup daemonGroup;"
]
},
{
"added": [
"\tBaseMonitor() {"
],
"header": "@@ -144,7 +144,7 @@ public abstract class BaseMonitor",
"removed": [
"\tpublic BaseMonitor() {"
]
},
{
"added": [
"\tInputStream loadModuleDefinitions( URL propertyFileURL) throws IOException {"
],
"header": "@@ -1306,7 +1306,7 @@ nextModule:",
"removed": [
"\tprotected InputStream loadModuleDefinitions( URL propertyFileURL) throws IOException {"
]
},
{
"added": [
"\tabstract InputStream applicationPropertiesStream()"
],
"header": "@@ -1338,7 +1338,7 @@ nextModule:",
"removed": [
"\tprotected abstract InputStream applicationPropertiesStream()"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java",
"hunks": [
{
"added": [],
"header": "@@ -23,7 +23,6 @@ package org.apache.derby.impl.services.monitor;",
"removed": [
"import org.apache.derby.impl.services.monitor.BaseMonitor;"
]
},
{
"added": [
"\tsynchronized final boolean initialize(boolean lite)"
],
"header": "@@ -166,7 +165,7 @@ public final class FileMonitor extends BaseMonitor implements java.security.Priv",
"removed": [
"\tpublic synchronized final boolean initialize(boolean lite)"
]
},
{
"added": [
"\tsynchronized final InputStream loadModuleDefinitions(URL propertyFileURL) throws IOException {"
],
"header": "@@ -178,7 +177,7 @@ public final class FileMonitor extends BaseMonitor implements java.security.Priv",
"removed": [
"\tprotected synchronized final InputStream loadModuleDefinitions(URL propertyFileURL) throws IOException {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java",
"hunks": [
{
"added": [
"final class PersistentServiceImpl implements PersistentService"
],
"header": "@@ -61,7 +61,7 @@ import java.security.PrivilegedActionException;",
"removed": [
"public class PersistentServiceImpl implements PersistentService"
]
},
{
"added": [
" PersistentServiceImpl( String subSubProtocol, Class storageFactoryClass)"
],
"header": "@@ -71,7 +71,7 @@ public class PersistentServiceImpl implements PersistentService",
"removed": [
" public PersistentServiceImpl( String subSubProtocol, Class storageFactoryClass)"
]
},
{
"added": [
" final class DirectoryList implements Enumeration, PrivilegedAction"
],
"header": "@@ -816,7 +816,7 @@ public class PersistentServiceImpl implements PersistentService",
"removed": [
" class DirectoryList implements Enumeration, PrivilegedAction"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/monitor/TopService.java",
"hunks": [
{
"added": [
"final class TopService {"
],
"header": "@@ -40,7 +40,7 @@ import java.util.Locale;",
"removed": [
"class TopService {"
]
},
{
"added": [
"\tProtocolKey key;",
"\tModuleInstance topModule;",
"\tHashtable\t\tprotocolTable;",
"\tVector\t\tmoduleInstances;",
"\tBaseMonitor\tmonitor;",
"\tboolean inShutdown;",
"\tPersistentService serviceType;"
],
"header": "@@ -49,32 +49,32 @@ class TopService {",
"removed": [
"\tprotected ProtocolKey key;",
"\tprotected ModuleInstance topModule;",
"\tprotected Hashtable\t\tprotocolTable;",
"\tprotected Vector\t\tmoduleInstances;",
"\tprotected BaseMonitor\tmonitor;",
"\tprotected boolean inShutdown;",
"\tprotected PersistentService serviceType;"
]
},
{
"added": [
"\tvoid setTopModule(Object instance) {"
],
"header": "@@ -99,7 +99,7 @@ class TopService {",
"removed": [
"\tprotected void setTopModule(Object instance) {"
]
},
{
"added": [
"\tObject getService() {",
"\tboolean isPotentialService(ProtocolKey otherKey) {"
],
"header": "@@ -124,12 +124,12 @@ class TopService {",
"removed": [
"\tprotected Object getService() {",
"\tprotected boolean isPotentialService(ProtocolKey otherKey) {"
]
},
{
"added": [
"\tsynchronized Object findModule(ProtocolKey key, boolean findOnly, Properties properties) {"
],
"header": "@@ -207,7 +207,7 @@ class TopService {",
"removed": [
"\tprotected synchronized Object findModule(ProtocolKey key, boolean findOnly, Properties properties) {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/reflect/DatabaseClasses.java",
"hunks": [
{
"added": [
"\tClass loadClassNotInDatabaseJar(String className) throws ClassNotFoundException {"
],
"header": "@@ -220,7 +220,7 @@ public abstract class DatabaseClasses",
"removed": [
"\tprotected Class loadClassNotInDatabaseJar(String className) throws ClassNotFoundException {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java",
"hunks": [
{
"added": [
"\tsynchronized LoadedGeneratedClass loadGeneratedClassFromData(String fullyQualifiedName, ByteArray classDump) {"
],
"header": "@@ -33,7 +33,7 @@ public final class ReflectClassesJava2 extends DatabaseClasses",
"removed": [
"\tprotected synchronized LoadedGeneratedClass loadGeneratedClassFromData(String fullyQualifiedName, ByteArray classDump) {"
]
},
{
"added": [
"\tpublic final Object run() {"
],
"header": "@@ -61,7 +61,7 @@ public final class ReflectClassesJava2 extends DatabaseClasses",
"removed": [
"\tpublic Object run() {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/RawStore.java",
"hunks": [
{
"added": [
"\t",
"\t<P>",
"\tClass is final as it has methods with privilege blocks",
"\tand implements PrivilegedExceptionAction.",
"public final class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportable, PrivilegedExceptionAction"
],
"header": "@@ -87,9 +87,13 @@ import java.security.PrivilegedExceptionAction;",
"removed": [
"public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportable, PrivilegedExceptionAction"
]
},
{
"added": [
"\tprivate synchronized boolean privExists( File file)"
],
"header": "@@ -1044,7 +1048,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
"\tprotected synchronized boolean privExists( File file)"
]
},
{
"added": [
"\tprivate synchronized boolean privExists(final StorageFile file)"
],
"header": "@@ -1061,7 +1065,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
"\tprotected synchronized boolean privExists(final StorageFile file)"
]
},
{
"added": [
" private synchronized boolean privDelete( File file)"
],
"header": "@@ -1079,7 +1083,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privDelete( File file)"
]
},
{
"added": [
" private synchronized boolean privMkdirs( File file)"
],
"header": "@@ -1097,7 +1101,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privMkdirs( File file)"
]
},
{
"added": [
" private synchronized boolean privIsDirectory( File file)"
],
"header": "@@ -1115,7 +1119,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privIsDirectory( File file)"
]
},
{
"added": [
" private synchronized boolean privRemoveDirectory( File file)"
],
"header": "@@ -1132,7 +1136,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privRemoveDirectory( File file)"
]
},
{
"added": [
" private synchronized boolean privRenameTo( File file1, File file2)"
],
"header": "@@ -1149,7 +1153,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privRenameTo( File file1, File file2)"
]
},
{
"added": [
" private synchronized boolean privCopyDirectory( StorageFile from, File to, byte[] buffer, String[] filter)"
],
"header": "@@ -1168,7 +1172,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privCopyDirectory( StorageFile from, File to, byte[] buffer, String[] filter)"
]
},
{
"added": [
" private synchronized boolean privCopyDirectory( File from, StorageFile to, byte[] buffer, String[] filter)"
],
"header": "@@ -1192,7 +1196,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privCopyDirectory( File from, StorageFile to, byte[] buffer, String[] filter)"
]
},
{
"added": [
" private synchronized boolean privCopyFile( File from, StorageFile to)"
],
"header": "@@ -1216,7 +1220,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized boolean privCopyFile( File from, StorageFile to)"
]
},
{
"added": [
" private synchronized String[] privList(final File file)"
],
"header": "@@ -1235,7 +1239,7 @@ public class RawStore implements RawStoreFactory, ModuleControl, ModuleSupportab",
"removed": [
" protected synchronized String[] privList(final File file)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseContainer.java",
"hunks": [
{
"added": [
"abstract class BaseContainer implements Lockable {"
],
"header": "@@ -59,7 +59,7 @@ import java.util.Hashtable;",
"removed": [
"public abstract class BaseContainer implements Lockable {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java",
"hunks": [
{
"added": [
"public final class BaseDataFileFactory"
],
"header": "@@ -121,7 +121,7 @@ that file was made to inherit from this one.",
"removed": [
"public class BaseDataFileFactory"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java",
"hunks": [
{
"added": [
"abstract class FileContainer "
],
"header": "@@ -81,7 +81,7 @@ import java.util.zip.CRC32;",
"removed": [
"public abstract class FileContainer "
]
},
{
"added": [
"\tFileContainer(BaseDataFileFactory factory) "
],
"header": "@@ -307,7 +307,7 @@ public abstract class FileContainer",
"removed": [
"\tprotected FileContainer(BaseDataFileFactory factory) "
]
},
{
"added": [
"\tabstract void createContainer(ContainerKey newIdentity) "
],
"header": "@@ -547,7 +547,7 @@ public abstract class FileContainer",
"removed": [
"\tprotected abstract void createContainer(ContainerKey newIdentity) "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/InputStreamContainer.java",
"hunks": [
{
"added": [
"final class InputStreamContainer extends FileContainer {"
],
"header": "@@ -44,7 +44,7 @@ import java.io.DataInputStream;",
"removed": [
"public class InputStreamContainer extends FileContainer {"
]
},
{
"added": [
"\tInputStreamContainer(BaseDataFileFactory factory) {",
"\tfinal boolean openContainer(ContainerKey newIdentity) throws StandardException {"
],
"header": "@@ -52,12 +52,12 @@ public class InputStreamContainer extends FileContainer {",
"removed": [
"\tpublic InputStreamContainer(BaseDataFileFactory factory) {",
"\tprotected final boolean openContainer(ContainerKey newIdentity) throws StandardException {"
]
},
{
"added": [
"\tvoid closeContainer()"
],
"header": "@@ -105,7 +105,7 @@ public class InputStreamContainer extends FileContainer {",
"removed": [
"\tprotected void closeContainer()"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java",
"hunks": [
{
"added": [],
"header": "@@ -51,7 +51,6 @@ import java.io.DataInput;",
"removed": [
"import java.security.PrivilegedAction;"
]
},
{
"added": [
"class RAFContainer extends FileContainer implements PrivilegedExceptionAction"
],
"header": "@@ -60,7 +59,7 @@ import java.security.PrivilegedActionException;",
"removed": [
"public class RAFContainer extends FileContainer implements PrivilegedExceptionAction"
]
},
{
"added": [
"\tRAFContainer(BaseDataFileFactory factory) {"
],
"header": "@@ -91,7 +90,7 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc",
"removed": [
"\tprotected RAFContainer(BaseDataFileFactory factory) {"
]
},
{
"added": [
"\tfinal void closeContainer() {"
],
"header": "@@ -160,7 +159,7 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc",
"removed": [
"\tprotected final void closeContainer() {"
]
},
{
"added": [
"\t synchronized StorageFile getFileName(ContainerKey identity, boolean stub,"
],
"header": "@@ -641,7 +640,7 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc",
"removed": [
"\t protected synchronized StorageFile getFileName(ContainerKey identity, boolean stub,"
]
},
{
"added": [
"\tsynchronized void createContainer(ContainerKey newIdentity)"
],
"header": "@@ -706,7 +705,7 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc",
"removed": [
"\tprotected synchronized void createContainer(ContainerKey newIdentity)"
]
},
{
"added": [
"\tsynchronized boolean removeFile(StorageFile file)"
],
"header": "@@ -725,7 +724,7 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc",
"removed": [
"\tprotected synchronized boolean removeFile(StorageFile file)"
]
},
{
"added": [
"\tsynchronized boolean openContainer(ContainerKey newIdentity)"
],
"header": "@@ -757,7 +756,7 @@ public class RAFContainer extends FileContainer implements PrivilegedExceptionAc",
"removed": [
"\tprotected synchronized boolean openContainer(ContainerKey newIdentity)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java",
"hunks": [
{
"added": [
"\t<P>",
"\tClass is final as it has methods with privilege blocks",
"\tand implements PrivilegedExceptionAction.",
"\t*/",
"public final class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,"
],
"header": "@@ -205,9 +205,12 @@ import java.util.zip.CRC32;",
"removed": [
"*/",
"public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,"
]
},
{
"added": [
" private synchronized StorageRandomAccessFile privRandomAccessFile(StorageFile file, String perms)"
],
"header": "@@ -4677,7 +4680,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,",
"removed": [
" protected synchronized StorageRandomAccessFile privRandomAccessFile(StorageFile file, String perms)"
]
},
{
"added": [
"\tprivate synchronized String[] privList(File file)"
],
"header": "@@ -4703,7 +4706,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,",
"removed": [
"\tprotected synchronized String[] privList(File file)"
]
},
{
"added": [
"\tprivate synchronized String[] privList(StorageFile file)"
],
"header": "@@ -4718,7 +4721,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,",
"removed": [
"\tprotected synchronized String[] privList(StorageFile file)"
]
},
{
"added": [
"\tprivate synchronized boolean privCopyFile(StorageFile from, File to)"
],
"header": "@@ -4734,7 +4737,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,",
"removed": [
"\tprotected synchronized boolean privCopyFile(StorageFile from, File to)"
]
},
{
"added": [
"\tprivate synchronized boolean privCopyFile(File from, StorageFile to)"
],
"header": "@@ -4749,7 +4752,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,",
"removed": [
"\tprotected synchronized boolean privCopyFile(File from, StorageFile to)"
]
},
{
"added": [
"\tprivate boolean privRemoveDirectory(StorageFile file)"
],
"header": "@@ -4764,7 +4767,7 @@ public class LogToFile implements LogFactory, ModuleControl, ModuleSupportable,",
"removed": [
"\tprotected boolean privRemoveDirectory(StorageFile file)"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/EmbeddedSimpleDataSource.java",
"hunks": [
{
"added": [
"public final class EmbeddedSimpleDataSource implements DataSource {"
],
"header": "@@ -56,7 +56,7 @@ import org.apache.derby.impl.jdbc.Util;",
"removed": [
"public class EmbeddedSimpleDataSource implements DataSource {"
]
},
{
"added": [
"\tprivate InternalDriver findDriver() throws SQLException {"
],
"header": "@@ -413,7 +413,7 @@ public class EmbeddedSimpleDataSource implements DataSource {",
"removed": [
"\tInternalDriver findDriver() throws SQLException {"
]
}
]
},
{
"file": "java/tools/org/apache/derby/impl/tools/ij/util.java",
"hunks": [
{
"added": [
"public final class util implements java.security.PrivilegedAction {"
],
"header": "@@ -51,7 +51,7 @@ import java.util.Locale;",
"removed": [
"public class util implements java.security.PrivilegedAction {"
]
},
{
"added": [
"\tstatic final String getSystemProperty(String propertyName) {"
],
"header": "@@ -680,7 +680,7 @@ AppUI.out.println(\"SIZE=\"+l);",
"removed": [
"\tpublic static final String getSystemProperty(String propertyName) {"
]
}
]
}
] |
derby-DERBY-467-7df5ffe3
|
DERBY-467 Make DRDA implementation classes and their constructors package
protected instead of public or protected. Code is only required to be accessed
from this package.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@379174 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/drda/org/apache/derby/impl/drda/DDMReader.java",
"hunks": [
{
"added": [
"\tDDMReader (DRDAConnThread agent, DssTrace dssTrace)"
],
"header": "@@ -152,7 +152,7 @@ class DDMReader",
"removed": [
"\tprotected DDMReader (DRDAConnThread agent, DssTrace dssTrace)"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAConnThread.java",
"hunks": [
{
"added": [
"class DRDAConnThread extends Thread {"
],
"header": "@@ -60,7 +60,7 @@ import org.apache.derby.impl.jdbc.EmbedSQLException;",
"removed": [
"public class DRDAConnThread extends Thread {"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java",
"hunks": [
{
"added": [
"class DRDAProtocolException extends Exception"
],
"header": "@@ -32,7 +32,7 @@",
"removed": [
"public class DRDAProtocolException extends Exception"
]
},
{
"added": [
"\tDRDAProtocolException(String msgid,"
],
"header": "@@ -210,7 +210,7 @@ public class DRDAProtocolException extends Exception",
"removed": [
"\tprotected DRDAProtocolException(String msgid,"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DRDAProtocolExceptionInfo.java",
"hunks": [
{
"added": [
"class DRDAProtocolExceptionInfo {"
],
"header": "@@ -20,7 +20,7 @@",
"removed": [
"public class DRDAProtocolExceptionInfo {"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/DecryptionManager.java",
"hunks": [
{
"added": [
"class DecryptionManager"
],
"header": "@@ -44,7 +44,7 @@ import java.math.BigInteger;",
"removed": [
"public class DecryptionManager"
]
}
]
},
{
"file": "java/drda/org/apache/derby/impl/drda/XADatabase.java",
"hunks": [
{
"added": [
"\tXADatabase (String dbName)"
],
"header": "@@ -52,7 +52,7 @@ class XADatabase extends Database {",
"removed": [
"\tprotected XADatabase (String dbName)"
]
}
]
}
] |
derby-DERBY-467-824ca0bb
|
DERBY-467 Reduce visibilty of context implementation classes and their methods.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@383600 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryContextImpl.java",
"hunks": [
{
"added": [
"class DataDictionaryContextImpl "
],
"header": "@@ -38,7 +38,7 @@ import org.apache.derby.iapi.error.ExceptionSeverity;",
"removed": [
"public class DataDictionaryContextImpl "
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/sql/execute/GenericExecutionContext.java",
"hunks": [
{
"added": [
"class GenericExecutionContext"
],
"header": "@@ -48,7 +48,7 @@ import org.apache.derby.iapi.error.ExceptionSeverity;",
"removed": [
"public class GenericExecutionContext"
]
},
{
"added": [
"\tprivate ResultSetFactory rsFactory;",
"\tprivate ResultSetStatisticsFactory rssFactory;",
"\tprivate ExecutionFactory execFactory;"
],
"header": "@@ -57,9 +57,9 @@ public class GenericExecutionContext",
"removed": [
"\tprotected ResultSetFactory rsFactory;",
"\tprotected ResultSetStatisticsFactory rssFactory;",
"\tprotected ExecutionFactory execFactory;"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/RAMTransactionContext.java",
"hunks": [
{
"added": [
"final class RAMTransactionContext extends ContextImpl"
],
"header": "@@ -27,7 +27,7 @@ import org.apache.derby.iapi.services.context.ContextManager;",
"removed": [
"public class RAMTransactionContext extends ContextImpl"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/raw/xact/XactContext.java",
"hunks": [
{
"added": [
"final class XactContext extends ContextImpl {",
"\tXactContext(ContextManager cm, String name, Xact xact, boolean abortAll, RawStoreFactory factory) {"
],
"header": "@@ -44,13 +44,13 @@ context manager (ie. typically a single user) for a single RawStoreFactory.",
"removed": [
"public class XactContext extends ContextImpl {",
"\tpublic XactContext(ContextManager cm, String name, Xact xact, boolean abortAll, RawStoreFactory factory) {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/jdbc/XATransactionState.java",
"hunks": [
{
"added": [
"final class XATransactionState extends ContextImpl {"
],
"header": "@@ -34,7 +34,7 @@ import javax.transaction.xa.XAException;",
"removed": [
"public final class XATransactionState extends ContextImpl {"
]
},
{
"added": [
"\tfinal EmbedConnection\tconn;"
],
"header": "@@ -45,7 +45,7 @@ public final class XATransactionState extends ContextImpl {",
"removed": [
"\tpublic final EmbedConnection\tconn;"
]
}
]
}
] |
derby-DERBY-467-858d8411
|
DERBY-467 Add intial framework for security checking of returned JDBC objects to
try and catch code that allows complete access to internal Derby objects, such
as the page cache.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@370570 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/testing/org/apache/derbyTesting/functionTests/util/SecurityCheck.java",
"hunks": [
{
"added": [
"/*",
"",
" Derby - Class org.apache.derbyTesting.functionTests.util.SecurityCheck",
"",
" Copyright 2006 The Apache Software Foundation or its licensors, as applicable.",
"",
" Licensed 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.",
"",
" */",
"",
"package org.apache.derbyTesting.functionTests.util;",
"",
"import java.lang.reflect.Constructor;",
"import java.lang.reflect.Field;",
"import java.lang.reflect.Method;",
"import java.lang.reflect.Modifier;",
"import java.util.Iterator;",
"import java.util.SortedMap;",
"import java.util.TreeMap;",
"",
"",
"/**",
" * Code to aid in checking the Security of Derby.",
" * This initial implementation only handles the emebdded code.",
" * Future work could expand to the client driver and network server.",
" */",
"public class SecurityCheck {",
"\t",
"\t/**",
"\t * List of classes in the public api for the embedded engine.",
"\t */",
"\tprivate static final String[] EMBEDDED_PUBLIC_API =",
"\t{",
"\t\t\"org.apache.derby.jdbc.EmbeddedDriver\",",
"\t\t\"org.apache.derby.jdbc.EmbeddedDataSource\",",
"\t\t\"org.apache.derby.jdbc.EmbeddedSimpleDataSource\",",
"\t\t\"org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource\",",
"\t\t\"org.apache.derby.jdbc.EmbeddedXADataSource\",",
"\t\t\"org.apache.derby.authentication.UserAuthenticator\",",
"\t};",
"\t",
"\t/**",
"\t * Is the passed in class part of the declared public api.",
"\t * Currently only the emebdded public api",
"\t * @param c class to be checked",
"\t * @return true if the class is part of the public api, false otherwise.",
"\t */",
"\tprivate static boolean isPublicApi(Class c)",
"\t{",
"\t\tfor (int i = 0; i < EMBEDDED_PUBLIC_API.length; i++)",
"\t\t{",
"\t\t\tif (EMBEDDED_PUBLIC_API[i].equals(c.getName()))",
"\t\t\t\treturn true;",
"\t\t}",
"\t\treturn false;",
"\t}",
"\t",
"\t/**",
"\t * Map of all classes that have been inspected.",
"\t * The key is the class name, if the value is null then",
"\t * the class is being inspected. Otherwise the value is",
"\t * a String description of the risks.",
"\t */",
"\tprivate static final SortedMap allInspectedClasses = new TreeMap();",
"\t",
"\t/**",
"\t * Perform security analysis of the public api for the embedded engine.",
"\t * Prints a report to System.out on completion.",
"\t * @throws ClassNotFoundException",
"\t */",
"\tpublic static void checkEmbeddedPublicApi() throws ClassNotFoundException",
"\t{",
"\t\tSystem.out.println(\"SecurityCheck: embedded public api classes\");",
"\t\tallInspectedClasses.clear();",
"\t\tfor (int i = 0; i < EMBEDDED_PUBLIC_API.length; i++)",
"\t\t\tSecurityCheck.inspectClass(EMBEDDED_PUBLIC_API[i]);",
"",
"\t\tSecurityCheck.report(true);",
"\t}",
"\t",
"\t/**",
"\t * Produce a report on System.out of all inspected classes",
"\t * that have risks associated with them.",
"\t *",
"\t */",
"\tpublic static void report()",
"\t{",
" SecurityCheck.report(false);",
"\t}",
"\t",
"\t/**",
"\t * Produce a report on System.out of all inspected classes",
"\t * that have risks associated with them. If reportClear is",
"\t * true then additionally all classes that have been inspected",
"\t * will be returned.",
"\t *",
"\t */",
"\tprivate static void report(boolean reportClear)",
"\t{",
"\t\tsynchronized (allInspectedClasses)",
"\t\t{",
"\t\tfor (Iterator it = allInspectedClasses.keySet().iterator(); it.hasNext(); )",
"\t\t{",
"\t\t\tObject key = it.next();",
"\t\t\tObject value = allInspectedClasses.get(key);",
"\t\t\tif (value == null)",
"\t\t\t{",
"\t\t\t\tif (reportClear)",
"\t\t\t\t System.out.println(\"CLEAR: \" + key);",
"\t\t\t}",
"\t\t\telse",
"\t\t\t{",
"\t\t\t\tSystem.out.print(value);",
"\t\t\t}",
"\t\t}",
"\t\t}",
"\t}",
"\t",
"\t/**",
"\t * Inspect a class for security risks. No output is generated",
"\t * by this call, the caller must call report() to obtain the risks.",
"\t * @param className",
"\t * @throws ClassNotFoundException",
"\t */",
"\tpublic static void inspectClass(String className) throws ClassNotFoundException",
"\t{\t\t\t",
"\t\tSecurityCheck.inspectClass(Class.forName(className), null);",
"\t}\t",
"\t",
"\t/**",
"\t * Inspect the class of the passed in Object for security risks.",
"\t * This inspects, at this level only, the actual type of",
"\t * the object, not the declared type. E.g. for DriverManager.getConnection",
"\t * the declared type is java.sql.Connection which has no security risks,",
"\t * but the implementation type returned may have many.",
"\t * ",
"\t * <code>",
"\t * Connection conn = DriverManager.getConnection(url);",
"\t * // will inspect the implementation call, eg. EmbedConnection30",
"\t * SecurityManager.inspect(conn);",
"\t * </code>",
"\t * No output is generated by this call,",
"\t * the caller must call report() to obtain the risks.",
"\t * @param o Obejct to be inspected",
"\t * @param declared the declared type of the object. ",
"\t */",
"\tpublic static void inspect(Object o, String declared)",
"\t{",
"\t\tif (o == null)",
"\t\t\treturn;",
"\t\t\t\t",
"\t\tSecurityCheck.inspectClass(o.getClass(), declared);",
"\t}",
"\t",
"\t/**",
"\t * Inspect a Derby class for security risks. This includes following potential",
"\t * references exposed through the class.",
"\t * <P>",
"\t * Risks looked at:",
"\t * <UL>",
"\t * <LI> public constructors in non-public class - ",
"\t * No justification for the constructor to be public.",
"\t * <LI> public constructors in non-final class and non-sealed package -",
"\t * Allows the class to be sub-classes through a injected class in",
"\t * the same package.",
"\t * <LI> public non-final field - Allows any one with a handle to",
"\t * the object to change the field.",
" * </UL>",
"\t * <P>",
"\t * The type of any public field or return type of any public method",
"\t * is also inspected. The assumption is that if such a field or method",
"\t * exists they have the potential to be called and return a valid object.",
"\t * <P>",
"\t * Note that this inspection is through the declared type of exposed",
"\t * references, not the actual runtime type. The actual runtime type",
"\t * might expose other classes that should be inspected.",
"\t * @param className",
"\t * @throws ClassNotFoundException",
"\t */",
"\tprivate static boolean inspectClass(Class c, String declared)",
"\t{\t\t",
"\t\tif (!c.getName().startsWith(\"org.apache.derby.\"))",
"\t\t\treturn false;",
"\t\t",
"\t\t// Initial focus on embedded engine",
"\t\tif (c.getName().startsWith(\"org.apache.derby.client.\"))",
"\t\t\treturn false;",
"\t\t",
"\t\tsynchronized (allInspectedClasses)",
"\t\t{",
"\t\tif (allInspectedClasses.containsKey(c.getName()))",
"\t\t\treturn true;",
"\t\t",
"\t\tallInspectedClasses.put(c.getName(), null);",
"\t\t\t\t",
"\t\tStringBuffer sb = new StringBuffer();",
"\t\t",
"\t\tsb.append(\"Class \");",
"\t\tsb.append(c.getName());",
"\t\tsb.append('\\n');",
"\t\t",
"\t\tif (declared != null)",
"\t\t{",
"\t\t\tallInspectedClasses.put(declared, \"Checked class declared as: \" + declared + \"\\n\");",
"\t\t\t",
"\t\t}",
"",
"\t\tboolean isPublicApi = SecurityCheck.isPublicApi(c);",
"\t",
"\t\tboolean hasIssues = false;",
"\t\t",
"\t\tboolean isSealed = c.getPackage().isSealed();",
"\t\tboolean isFinal = Modifier.isFinal(c.getModifiers());",
"\t\tboolean isPublic = Modifier.isPublic(c.getModifiers());",
"\t\tboolean isAbstract = Modifier.isAbstract(c.getModifiers());",
"\t\t",
"\t\tConstructor[] constructors = c.getConstructors();",
"\t\t",
"\t\tboolean hasPublicConstructor = constructors.length != 0;",
"\t\t",
"\t\tif (hasPublicConstructor && !isPublic)",
"\t\t{",
"\t\t\thasIssues = true;",
"\t\t\t",
"\t\t\t// No reason for a public constructor in a non-public class",
"\t\t\tsb.append(\"..public constructors in non-public class\\n\");",
"\t\t\t",
"\t\t\t// class can be sub-classed even though it is not public",
"\t\t\tif (!isFinal && !isSealed)",
"\t\t\t\tsb.append(\"..public constructors in non-final class and non-sealed package\\n\");",
"\t\t}",
"\t\t",
"\t\tif (hasPublicConstructor && isPublic)",
"\t\t{",
"\t\t\t// TODO: Need to work on these checks.",
"\t\t\tif (!isPublicApi)",
"\t\t\t{",
"\t\t\t //hasIssues = true;",
"\t\t\t",
"\t\t\t // anyone can create instances of this class",
"\t\t\t //sb.append(\"..public constructors in public class\\n\");",
"\t\t\t}",
"",
"\t\t\t// and anyone can sub-class this class",
"\t\t\tif (!isFinal)",
"\t\t\t{",
"\t\t\t\t//hasIssues = true;",
"\t\t\t\t//sb.append(\"..public constructors in public non-final class\\n\");",
"\t\t\t}",
"\t\t}",
"\t\t",
"\t\tfor (int i = 0; i < constructors.length; i++)",
"\t\t{",
"\t\t\tif (hasIssues)",
"\t\t\t{",
"\t\t\t\tsb.append(\"..public constructor: \");",
"\t\t\t\tsb.append(constructors[i].toString());",
"\t\t\t\tsb.append('\\n');",
"\t\t\t}",
"\t\t}",
"\t\t",
"\t\tField[] fields = c.getFields();",
"\t\tfor (int i = 0; i < fields.length; i++)",
"\t\t{",
"\t\t\tField f = fields[i];",
"\t\t\tboolean isStatic = Modifier.isStatic(f.getModifiers());",
"\t\t\t\t\t\t",
"\t\t\tClass fieldType = f.getType();",
"\t\t\tSecurityCheck.inspectClass(fieldType, null);",
"\t\t\t",
"\t\t\tif (Modifier.isFinal(f.getModifiers()))",
"\t\t\t{",
"\t\t\t\t// TODO: Should this be a concern if non-static?",
"\t\t\t\tcontinue;",
"\t\t\t}",
"\t\t\t",
"\t\t\thasIssues = true;",
"\t\t\tsb.append(\"..public non-final field: \");",
"\t\t\tsb.append(f.toString());",
"\t\t\tsb.append('\\n');",
"\t\t}",
"",
"\t\tMethod[] methods = c.getMethods();",
"\t\tfor (int i = 0; i < methods.length; i++)",
"\t\t{",
"\t\t\tMethod m = methods[i];",
"\t\t\t\t\t\t",
"\t\t\tClass methodType = m.getReturnType();",
"\t\t\tif (SecurityCheck.inspectClass(methodType, null))",
"\t\t\t{",
"\t\t\t\t// method returns a class of interest to us.",
"\t\t\t\t",
"\t\t\t\t// just a method returning a public api",
"\t\t\t\tif (SecurityCheck.isPublicApi(methodType))",
"\t\t\t\t\tcontinue;",
"\t\t\t\t",
"\t\t\t\t/*",
"\t\t\t\t * Not sure this is a vaild risk.",
"\t\t\t\thasIssues = true;",
"\t\t\t\tsb.append(\"..public method returning non-public api class: \");",
"\t\t\t\tsb.append(m.toString());",
"\t\t\t\tsb.append(\"\\n\");",
"\t\t\t\t*/",
"\t\t\t}",
"\t\t\t",
"\t\t}\t\t",
"\t\tif (hasIssues)",
"\t\t\tallInspectedClasses.put(c.getName(), sb.toString());",
"\t\t}",
"\t\t",
"\t\treturn true;",
"\t\t",
"\t}",
"}"
],
"header": "@@ -0,0 +1,324 @@",
"removed": []
}
]
}
] |
derby-DERBY-467-93fa39e6
|
DERBY-467 Reduce the visibility of some methods in classes for EmbedConnection.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@383595 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java",
"hunks": [
{
"added": [
" private void close(StandardException e) throws SQLException {"
],
"header": "@@ -944,7 +944,7 @@ public class EmbedConnection implements EngineConnection",
"removed": [
" private void close(Exception e) throws SQLException {"
]
}
]
},
{
"file": "java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java",
"hunks": [
{
"added": [
"\tvoid commit() throws StandardException",
"\tvoid rollback() throws StandardException"
],
"header": "@@ -232,12 +232,12 @@ public final class TransactionResourceImpl",
"removed": [
"\tprotected void commit() throws StandardException",
"\tprotected void rollback() throws StandardException"
]
},
{
"added": [
"\tvoid clearLcc()",
"\tfinal void setupContextStack()"
],
"header": "@@ -260,12 +260,12 @@ public final class TransactionResourceImpl",
"removed": [
"\tprotected void clearLcc()",
"\tprotected final void setupContextStack()"
]
},
{
"added": [
"\tfinal void restoreContextStack() {"
],
"header": "@@ -274,7 +274,7 @@ public final class TransactionResourceImpl",
"removed": [
"\tprotected final void restoreContextStack() {"
]
},
{
"added": [
"\tfinal SQLException handleException(Throwable thrownException,"
],
"header": "@@ -288,7 +288,7 @@ public final class TransactionResourceImpl",
"removed": [
"\tprotected final SQLException handleException(Throwable thrownException,"
]
},
{
"added": [
"\tboolean cleanupOnError(Throwable e)"
],
"header": "@@ -415,7 +415,7 @@ public final class TransactionResourceImpl",
"removed": [
"\tpublic boolean cleanupOnError(Throwable e)"
]
},
{
"added": [
"\tboolean isIdle()"
],
"header": "@@ -423,7 +423,7 @@ public final class TransactionResourceImpl",
"removed": [
"\tpublic boolean isIdle()"
]
}
]
}
] |
derby-DERBY-4670-01632952
|
DERBY-4670: ThreadDump class included in insane jars
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1128243 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/build/org/apache/derbyBuild/classlister.java",
"hunks": [
{
"added": [
"import org.apache.derby.iapi.services.sanity.SanityManager;"
],
"header": "@@ -22,13 +22,11 @@",
"removed": [
"import org.apache.derby.iapi.util.ByteArray;",
"import java.io.*;",
""
]
},
{
"added": [
" if (!SanityManager.DEBUG &&",
" className.matches(\"^org\\\\.apache\\\\.derby\\\\..*\\\\.sanity\\\\..*\"))",
" {",
" // Don't include sanity classes in insane builds.",
" return;",
" }",
""
],
"header": "@@ -460,6 +458,13 @@ public class classlister {",
"removed": []
},
{
"added": [
"\t\t\t\tif (!SanityManager.DEBUG) {"
],
"header": "@@ -577,7 +582,7 @@ public class classlister {",
"removed": [
"\t\t\t\tif (!org.apache.derby.iapi.services.sanity.SanityManager.DEBUG) {"
]
}
]
}
] |
derby-DERBY-4671-40a9fb59
|
DERBY-4671: Embedded driver does not work with jbossCache
Set the type of the dynamic parameters in statements like
INSERT INTO T SELECT ? FROM T
to prevent a NullPointerException and to revert to the pre-10.6
behaviour.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@948045 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java",
"hunks": [
{
"added": [
"\t * Set the type of each parameter in the result column list for this",
"\t * table constructor."
],
"header": "@@ -304,12 +304,8 @@ public abstract class ResultSetNode extends QueryTreeNode",
"removed": [
"\t * Set the type of each parameter in the result column list if this node",
"\t * represents a table constructor (aka VALUES clause). Table constructors",
"\t * are represented either by a {@code RowResultSetNode} or by a",
"\t * {@code UnionNode} with multiple {@code RowResultSetNode} children and",
"\t * whose {@code tableConstructor()} method returns {@code true}. For all",
"\t * other nodes, this method should be a no-op."
]
}
]
}
] |
derby-DERBY-4674-39f0127f
|
DERBY-4674: Re-enable the BooleanValuesTest on jdk 1.4: simply disable the xml part of the test on that platform.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@947656 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4674-7e7c0879
|
DERBY-4674: BooleanValuesTest fails if Xalan is not available
Skip the test if the required XML libraries are not present.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@947442 13f79535-47bb-0310-9956-ffa450edef68
|
[] |
derby-DERBY-4676-4f7da81c
|
DERBY-4676: NullPointerException on SELECT on INNER JOIN
Check whether the page is latched after waiting for a lock, and assume
that the row has been deleted if it is not latched.
git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@952138 13f79535-47bb-0310-9956-ffa450edef68
|
[
{
"file": "java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.java",
"hunks": [
{
"added": [
" if (pos.current_page == null)",
" {",
" // The page is not latched after locking the row. This happens if",
" // the row was deleted while we were waiting for the lock. Return",
" // false to indicate that the row is no longer valid. (DERBY-4676)",
" return false;",
" }",
""
],
"header": "@@ -284,6 +284,14 @@ public abstract class GenericConglomerateController",
"removed": []
}
]
},
{
"file": "java/engine/org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.java",
"hunks": [
{
"added": [
" * <p>",
" * </p>",
" *",
" * </p>",
" *",
" * <p>",
" * If the row pointed to by {@code pos} does not exist (including the",
" * case where the page itself does not exist), the page will not be",
" * latched, and {@code pos.current_page} will be set to {@code null}.",
" * </p>",
" *",
" * @param pos the position to a row on the page that should be latched",
" * @return {@code true} if the page was successfully latched, or",
" * {@code false} otherwise"
],
"header": "@@ -276,11 +276,25 @@ public abstract class OpenConglomerate",
"removed": []
},
{
"added": [
" * <p>",
" * </p>",
" *",
" * </p>",
" *"
],
"header": "@@ -329,13 +343,18 @@ public abstract class OpenConglomerate",
"removed": []
},
{
"added": [
" * </p>",
" *",
" * </p>",
" *",
" * <p>",
" * When this method returns, the page holding the row pointed to by the",
" * {@code RowLocation} is latched. This is however not the case if",
" * {@code moveForwardIfRowDisappears} is {@code false} and the row has",
" * disappeared. Then the latch will be released before the method returns,",
" * and {@code pos.current_page} will be set to {@code null}.",
" * </p>"
],
"header": "@@ -344,11 +363,22 @@ public abstract class OpenConglomerate",
"removed": []
},
{
"added": [
" * is released. If false, and the row disappears, the",
" * latch will be released again and false is returned."
],
"header": "@@ -356,8 +386,8 @@ public abstract class OpenConglomerate",
"removed": [
" * is released. If false an exception will be thrown if",
" * the row disappears."
]
}
]
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.